public async Task <ActionResult> Detail(Guid id, SuggestionDetailVM vm) { if (!ModelState.IsValid) { vm.Categories = _categoryService.GetSelectList(); return(View(vm)); } APIResultVM result = new APIResultVM(); var user = await _userManager.FindByNameAsync(User.Identity.Name); if (id.IsNull() || id == Guid.Empty) { result = await _service.AddAsync(vm.Rec, user.Id); } else { result = await _service.UpdateAsync(id, vm.Rec, user.Id); } if (!result.IsSuccessful) { if (result.Messages.Any()) { foreach (var error in result.Messages) { ModelState.AddModelError("GeneralError", error); } } return(View(vm)); } return(RedirectToAction("Index", "Home")); }