// GET: Customer/Create public ActionResult Create() { CustomerViewModel customerVM = new Models.CustomerViewModel(); customerVM.CustomerId = 0; return(View(customerVM)); }
public static Models.Customer ToModel(this Models.CustomerViewModel vm) { return(new Models.Customer { Id = vm.CustomerId, FirstName = vm.FirstName, LastName = vm.LastName, MemberSince = vm.MemberSince, Wallet = vm.Wallet }); }
public Models.CustomerViewModel Get(Guid id) { Models.CustomerViewModel result = null; try { var entity = Repository.GetCustomerById(id); result = Mapper.Map <CustomerViewModel>(entity); } catch { } return(result); }
public void Test_UpdateCustomerWithoutLastName() { Models.CustomerViewModel customer = new Models.CustomerViewModel() { Id = Guid.Parse("88A96958-A302-4913-9ADC-1997B49C7571"), FirstName = "Peter", LastName = "" }; var customerService = new CustomerService(); var res = customerService.UpdateCustomer(customer); Assert.AreEqual(true, res); }