private void InitUserSession() { try { _SessionData = new UserDataSession() { UserName = User.Identity.Name, }; DataMapping.Entities.UserProfile user = UserProfilesLogic.GetUserByUserName(User.Identity.Name); _SessionData.UserId = user.UserId; _SessionData.profileImageUrl = user.ProfilePictureUrl; if (Roles.IsUserInRole("Admin")) { _SessionData.UserRole = UserRoles.Admin; } else if (Roles.IsUserInRole("Employee")) { _SessionData.UserRole = UserRoles.Employee; } Session["UserSession"] = _SessionData; } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/Base/InitUserSession" }); } }
public ActionResult UploadDocument() { UserDataSession userSession = SessionData; userSession.ImgUrl = ""; SessionData = userSession; return(PartialView("CreateImage", SessionData.ImgUrl)); }
public ActionResult UploadImageToEdit(string imgurl) { UserDataSession userSession = SessionData; userSession.ImgUrl = imgurl; SessionData = userSession; return(PartialView("CreateImage", imgurl)); }
public ActionResult UploadProfileImage(HttpPostedFileBase file) { string userName = ""; if (SessionData == null) { userName = SessionData.UserName; } if (file != null) { List <string> content = file.ContentType.Split('/').ToList(); if (content[0] == "image") { string fileName = Path.GetFileName(file.FileName); string fileUrl = WebMessaging.UploadMessageAttachment(file, file.ContentType, fileName); UserDataSession userSession = SessionData; userSession.ImgUrl = fileUrl; SessionData = userSession; } } return(PartialView("CreateImage", SessionData.ImgUrl)); }