Exemplo n.º 1
0
        public ActionResult Create([Bind(Include = "FirstName, LastName, Address, PhoneNumber, CustomerType")]
                                   CustomerDTO model)
        {
            if (ModelState.IsValid)
            {
                model.AccountNumber = _customerServices.GenerateAccountNumber();
                model.RentedBooks   = 0;

                var customer = DependencyResolver.Current.GetService <ICustomer>();
                Mapper.Map(model, customer);

                _customerServices.Add(customer);

                return(RedirectToAction("Index"));
            }

            return(View(model));
        }