1using System.Runtime.InteropServices;
9using Microsoft.EntityFrameworkCore;
19 public List<CustomerClientModel>?
Customers {
get;
private set; }
48 var updatedCustomers =
Customers ??
new();
55 catch (DbUpdateException e)
60 catch (InvalidOperationException e)
82 catch (DbUpdateException e)
87 catch (InvalidOperationException e)
async void UpdateInfoMessage(InfoMessage msg)
List< CustomerClientModel >? Customers
readonly CustomerService _customerService
CustomerViewModel(DataContext context, IMapper mapper, AlertService alertService)
async Task< CustomerClientModel?> UpdateCustomer(CustomerClientModel customer)
async Task< CustomerClientModel > AddCustomer(CustomerClientModel customer)
async Task GetCustomers()
void UpdateCustomers(List< CustomerClientModel > customers)
async Task< CustomerClientModel?> GetCustomerById(int id)
AlertService _alertService
CustomerService class inserts and updates Customer in the Database
async Task< Customer > AddCustomer(Customer customer)
Adds a Customer to the database
async Task< List< Customer > > GetAllCustomers(int? id=null)
Read all Customers from database
async Task< Customer > GetCustomerById(int id)
Read one Customer with id from database
async Task< Customer > UpdateCustomer(Customer customer)
Updates changes on a Customer in the database
static void Error(string msg)