コード例 #1
0
        public ActionResult Add(CustomerAddViewModel viewModel)
        {
            if (TryUpdateModel(viewModel))
            {
                CustomerAddViewModel model = new CustomerAddViewModel();
                CustomerService cService = new CustomerService();
                cService.Add(viewModel.NewCustomer);
                model.Message = "Customer was added";
                return View(model);
            }

            return View(new CustomerAddViewModel());
        }
コード例 #2
0
 public ActionResult Add()
 {
     CustomerAddViewModel viewModel = new CustomerAddViewModel();
     return View(viewModel);
 }