public async Task <ActionResult> Register(RegisterCustomerViewModel customer) { if (ModelState.IsValid) { if (await client.AddCustomer(new Customer() { Id = Guid.NewGuid().ToString(), Email = customer.Email, Name = customer.Name, Password = customer.Password, AddressLine1 = customer.AddressLine1, AddressLine2 = customer.AddressLine2, PinCode = customer.PinCode })) { LoginViewModel loginModel = new LoginViewModel(); loginModel.Email = customer.Email; loginModel.Password = customer.Password; var authcustomer = await client.AuthenticateCustomer(new Customer() { Email = customer.Email, Password = customer.Password }); if (authcustomer != null) { CustomPrincipalSerializeModel serializeModel = new CustomPrincipalSerializeModel(); serializeModel.CustomerID = authcustomer.Id; serializeModel.FirstName = authcustomer.Name; serializeModel.Email = authcustomer.Email; Response.Cookies.Add(Utility.Utility.EncryptAndSet(serializeModel)); return(RedirectToAction("Index", "Home")); } } } return(View(customer)); }