public ActionResult Create(CustomerCRUDModel model) { if (!ModelState.IsValid) { return(this.View(model)); } try { CustomerService.Create(model.Name); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(View(model)); } return(RedirectToAction("Index", "Customer")); }
public ActionResult Edit(Guid id) { try { Customer customer = CustomerService.Get(id); CustomerCRUDModel model = new CustomerCRUDModel(); model.Id = customer.Id; model.Name = customer.Name; model.CreatedDate = customer.CreatedDate; model.LastModifiedDate = customer.LastModifiedDate; return(View(model)); } catch (Exception ex) { } return(RedirectToAction("Index")); }
public ActionResult Create() { CustomerCRUDModel model = new CustomerCRUDModel(); return(View(model)); }