Ejemplo n.º 1
0
 public async Task <JsonResult> Update(UsersViewModel item)
 {
     try {
         var imageFile = item.profileImage.Contains(CurrentUser.CompanyID) ? item.profileImage : "/UPLOADS/SubscriberFiles/" + CurrentUser.CompanyID + "/" + FileManagerUtility.UploadImage(Server, item.profileImage, Server.MapPath("/UPLOADS/SubscriberFiles/") + CurrentUser.CompanyID, "File" + TimeFormatter.DateToString1(GetCurrentTime()));
         if (imageFile != null)
         {
             item.profileImage = imageFile;
             var realModel = _userService.GetByIDAsync(item.ID).Result;
             var model     = UsersUtility.UVMToUM(realModel, item);
             model.UpdatedAt  = GetCurrentTime();
             model.UpdatedBy  = CurrentUser.ID;
             model.isArchived = false;
             _userService.Update(model);
             return(Json(new { success = true, data = model }));
         }
         return(Json(new { success = false }));
     } catch { return(Json(new { success = false })); }
 }