예제 #1
0
        // 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
     });
 }
예제 #3
0
        public Models.CustomerViewModel Get(Guid id)
        {
            Models.CustomerViewModel result = null;

            try
            {
                var entity = Repository.GetCustomerById(id);
                result = Mapper.Map <CustomerViewModel>(entity);
            }
            catch { }

            return(result);
        }
예제 #4
0
        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);
        }