コード例 #1
0
        public ActionResult New(CustomerViewModel model, string submit)
        {
            model.Id = GetUniqueId();

            if (!ModelState.IsValid)
            {
                return View(model);
            }

            if (String.Equals(submit, "Save", StringComparison.InvariantCultureIgnoreCase))
            {
                var customer = new CustomerInfo
                                   {
                                       Id = model.Id,
                                       Name = model.Name,
                                       City = model.City,
                                   };

                this.customerService.SetCustomer(customer);
            }

            return RedirectToAction("Index", "Customer");
        }
コード例 #2
0
 public ActionResult New()
 {
     var model = new CustomerViewModel { Id = -1, Name = "", City = "" };
     return View(model);
 }