Esempio n. 1
0
 public void FormView_InsertItem(Model.Customer customer)
 {
     var customerService = new CustomerService();
             customerService.InsertCustomer(customer);
             Session["saved"] = true;
             Response.Redirect("~/Pages/Customer/CustomerListing.aspx");
 }
Esempio n. 2
0
 public Model.Customer CustomerFormView_GetItem([RouteData] int id)
 {
     try
     {
         CustomerService customerservice = new CustomerService();
         return customerservice.GetCustomer(id);
     }
     catch (Exception)
     {
         ModelState.AddModelError(String.Empty, "Ett fel inträffade");
         return null;
     }
 }
Esempio n. 3
0
 //spara ny kund
 public void FormView_InsertItem(Model.Customer customer)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var customerService = new CustomerService();
             customerService.InsertCustomer(customer);
             Session["saved"] = true;
             Response.RedirectToRoute("ListCustomer", null);
             Context.ApplicationInstance.CompleteRequest();
         }
         catch (Exception)
         {
             ModelState.AddModelError(String.Empty, "Ett fel inträffade när kunden skulle sparas");
         }
     }
 }