public JsonResult Update(int id, string firstName, string lastName, string emildID, int userRoleID, List<string> officesID) { var userManager = new DataAccess.UserManager(); var status = userManager.UpdateUser(id, firstName, lastName, emildID, userRoleID, officesID); return Json(status); }
public JsonResult UpdateProfileImage() { var status = false; HttpPostedFileBase myFile = null; if (Request.Files.Count > 0) myFile = Request.Files[0]; if (myFile != null && myFile.ContentLength != 0) { string pathForSaving = Server.MapPath("~/ImageUploads"); if (SharedFunction.CreateFolderIfNeeded(pathForSaving)) { try { string fileName = DateTime.Now.ToString("MMddyyyyHHmmss") + Path.GetExtension(myFile.FileName); myFile.SaveAs(Path.Combine(pathForSaving, fileName)); string path = "~/ImageUploads/" + fileName; var userManager = new DataAccess.UserManager(); status = userManager.UpdateUser(Convert.ToInt32(Request.Form["id"]), Request.Form["firstName"].ToString(), Request.Form["lastName"].ToString(), Request.Form["emildID"].ToString(), Convert.ToInt32(Request.Form["userRoleID"]), Request.Form["officesID"].Split(',').ToList(), fileName, path); } catch (Exception ex) { return Json(ex.InnerException); } } } return Json(status); }