public IActionResult ProfileEdit(string slugUrl, ProfileViewModel model) { SetPageContent("profileEdit"); IFormFile headerImage = Request.Form.Files.GetFile("headerImage"); IFormFile avatarImage = Request.Form.Files.GetFile("avatarImage"); var galleryImages = Request.Form.Files.GetFiles("galleryImage"); if (ModelState.IsValid) { var result = _userEngine.SaveUser(model, headerImage, avatarImage, galleryImages); switch (result.Type) { case TransactionType.Error: ModelState.AddModelError("", result.Message); return(View(getProfileViewModel(model))); case TransactionType.Success: return(RedirectToRoute("profile", new { slugUrl = slugUrl })); } } SetValidationErrorMessage(); // If we got this far, something failed, redisplay form return(View(getProfileViewModel(model))); }