public ActionResult MyUserInfo(MyUserInfoViewModel userInfo, HttpPostedFileBase image = null) { ViewBag.UserInfo = "active open"; ViewBag.MyUserInfo = "active"; if (ModelState.IsValid) { UserInfo userInfos = myUserInfo.UserInfo(userInfo.UserID); userInfos.UserName = userInfo.UserName; if (image != null) { userInfos.ImageMimeType = image.ContentType; userInfos.ImageData = new byte[image.ContentLength]; image.InputStream.Read(userInfos.ImageData, 0, image.ContentLength); } myUserInfo.SaveMyUserInfo(userInfos); myUserInfoView = new MyUserInfoViewModel { UserInfo = userInfos, }; ViewBag.Success = "true"; return(View(myUserInfoView)); } else { myUserInfoView = new MyUserInfoViewModel { UserInfo = myUserInfo.UserInfo(userInfo.UserID), }; ViewBag.Fault = "False"; return(View(myUserInfoView)); } }
public ActionResult MyUserInfo() { ViewBag.UserInfo = "active open"; ViewBag.MyUserInfo = "active"; TempData.Clear(); int userID = Convert.ToInt32(Session["UserID"].ToString()); myUserInfoView = new MyUserInfoViewModel { UserInfo = myUserInfo.UserInfo(userID), }; return(View(myUserInfoView)); }
public ActionResult Index(bool IsRead = false) { ViewBag.Index = "active"; myUserInfoView = new MyUserInfoViewModel(); if (!IsRead) { InformMessage informMessage = EFInformMessage.InformMessages.OrderByDescending(i => i.CreateTime).FirstOrDefault(); if (informMessage != null) { if (DateTime.Now.AddDays(-3).CompareTo(Convert.ToDateTime(informMessage.CreateTime)) < 0) { myUserInfoView.InformMessage = informMessage; } } } return(View(myUserInfoView)); }