public JsonResult EditTenancyApplication(RentalApplicationModel model) { if (ModelState.IsValid) { var files = Request.Files; var userName = User.Identity.Name; if (String.IsNullOrEmpty(userName)) { return(Json(new { Success = false, ErrorMsg = "User not exixt!" })); } var login = AccountService.GetLoginByEmail(userName); var result = RentalService.EditRentallApllication(model, login, Request.Files); return(result.IsSuccess ? Json(new { Success = true, MediaFiles = result.NewObject as List <MediaModel> }) : Json(new { Success = false, ErrorMsg = result.ErrorMessage })); } else { return(Json(new { Success = false })); } }