public ActionResult Login(string username, string password, string ReturnUrl) { ServiceReference.Customer cus = new ServiceReference.Customer(); if (ModelState.IsValid) { ServiceReference.Service1Client customer = new ServiceReference.Service1Client(); cus = customer.Login(username, password); if (cus == null) { ModelState.AddModelError("", "The username or password is incorrect"); } else { FormsAuthentication.SetAuthCookie(cus.FirstName, false); int c = cus.CustomerID; Session["CustomerId"] = c; if (ReturnUrl != null) { return(Redirect(ReturnUrl)); } else { return(RedirectToAction("Index", "Home")); } } } return(View(cus)); }
public ActionResult Register([Bind(Include = "FirstName,LastName,Username,Password")] ServiceReference.Customer cust, [Bind(Include = "AddressType,City,Country,PostalCode,Street,Suburb")] ServiceReference.Address add, [Bind(Include = "ContactType,Contact1")] ServiceReference.Contact cont) { if (ModelState.IsValid) { try { ServiceReference.Service1Client cus = new ServiceReference.Service1Client(); cus.Register(cust, add, cont); MembershipUser NewUser = Membership.CreateUser(cust.UserName, cust.Password); FormsAuthentication.SetAuthCookie(cust.FirstName, false); return(RedirectToAction("Index", "Home")); } catch (MembershipCreateUserException e) { ModelState.AddModelError("Registration Error", "Registration error: " + e.StatusCode.ToString()); } } return(View()); }
public System.Threading.Tasks.Task <bool> UpdateCustomerAsync(ServiceReference.Customer obj) { return(base.Channel.UpdateCustomerAsync(obj)); }