コード例 #1
0
 private static Customer ToCustomer(SebCustomer entry)
 =>
 new Customer
 {
     Id         = entry.Id,
     PersonalId = entry.PersonalId,
     FirstName  = entry.FirstName,
     LastName   = entry.LastName
 };
コード例 #2
0
 public ActionResult Create([Bind(Include = "FirstName, LastName, PersonalId")] SebCustomer customer)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Customers.Add(customer);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (RetryLimitExceededException /* dex */)
     {
         //Log the error (uncomment dex variable name and add a line here to write a log.
         ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
     }
     return(View(customer));
 }