public async Task <ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { using (AuthServiceClient client = new AuthServiceClient()) { RegisDTO regisDTO = new RegisDTO { Email = model.Email, Password = model.Password, Role = "customer", Address = model.Address, City = model.City, PostalCode = model.PostalCode, FirstName = model.FirstName, LastName = model.LastName, StateProvinceID = model.State }; OperationDetails operationDetails = await Task.Run(() => client.Register(regisDTO)); if (operationDetails.Status == OperationDetails.Statuses.Success) { return(RedirectToAction("Index", "Home")); } else { ModelState.AddModelError(operationDetails.Status.ToString(), operationDetails.Message); } } } return(View(model)); }