コード例 #1
0
ファイル: UserMaps.cs プロジェクト: piyushpatel928/WeedAngel
        public User UserVMtoUser(UserViewModel uvm)
        {
            User usr = new User();
            usr.FullName = uvm.FullName;
            usr.State = uvm.State;
            usr.Status = uvm.Status;
            usr.Zipcode = uvm.ZipCode;
            usr.Email = uvm.Email;
            usr.Gender = uvm.Gender;
            usr.MaritalStatus = uvm.MaritalStatus;

            usr.TellForGetHigh = uvm.TellUsAbtYrFstTimeHigh;
            usr.FavDispensory = uvm.FvrtDispensaries;
            usr.FavStrains = uvm.FvrtStrains;
            usr.FavWayToGetHigh = uvm.FvrtWayToHigh;

            usr.AboutMe = uvm.AboutMe;
            if (uvm.AvtarName != null)
            {
                usr.ProfileImageName = uvm.AvtarName;
                usr.ProfileImagePath = uvm.AvtarPathName;

            }
            usr.RegionId = 1;

            usr.Instagram = uvm.InstagramPage;
            usr.Facebook = uvm.FacebookPage;
            usr.Twitter = uvm.TwitterPage;

            return usr;
        }
コード例 #2
0
ファイル: UserMaps.cs プロジェクト: piyushpatel928/WeedAngel
        public UserViewModel UserToUserVm(User usr)
        {
            UserViewModel uvm = new UserViewModel();

            uvm.FullName = usr.FullName;
            uvm.UserName = usr.UserName;
            uvm.State = usr.State;
            uvm.Status = usr.Status;
            uvm.ZipCode = usr.Zipcode;
            uvm.Email = usr.Email;
            uvm.Gender = usr.Gender;
            uvm.MaritalStatus = usr.MaritalStatus;
            uvm.TellUsAbtYrFstTimeHigh = usr.TellForGetHigh;
            uvm.FvrtDispensaries = usr.FavDispensory;
            uvm.FvrtStrains = usr.FavStrains;
            uvm.FvrtWayToHigh = usr.FavWayToGetHigh;
            uvm.AboutMe = usr.AboutMe;
            if (usr.ProfileImageName != null)
            {
                uvm.AvtarName = usr.ProfileImageName;
                uvm.AvtarPathName = usr.ProfileImagePath;
            }
            uvm.InstagramPage = usr.Instagram;
            uvm.FacebookPage = usr.Facebook;
            uvm.TwitterPage = usr.Twitter;

            return uvm;
        }
コード例 #3
0
 public ActionResult ForgotPassword(UserViewModel uvm)
 {
     if (Session["UserId"] != null)
     {
         return View();
     }
     else
     {
         return RedirectToAction("LogIn", "Home");
     }
 }
コード例 #4
0
        public ActionResult UpdateProfile(UserViewModel uvm, HttpPostedFileBase avtar)
        {
            if (Session["UserId"] != null)
            {
                int id = int.Parse(Session["UserId"].ToString());
                if (avtar != null && avtar.ContentLength > 0)
                {
                    string ext = avtar.FileName;
                    ext = ext.Substring(ext.LastIndexOf("."));
                    if (ext == ".jpg" || ext == ".jpeg" || ext == ".png")
                    {
                        var fileName = Path.GetFileName(avtar.FileName);
                        string originalpath = avtar.FileName;
                        fileName = fileName.Substring(0, fileName.LastIndexOf(".") - 1);
                        fileName = fileName + DateTime.Now.Ticks.ToString() + ext;
                        var path = Path.Combine(Server.MapPath("~/UploadedImages/"), fileName);
                        avtar.SaveAs(path);
                        string path1 = "~/UploadedImages/" + fileName;
                        uvm.AvtarName = avtar.FileName;
                        uvm.AvtarPathName = path1;
                    }
                    else
                    {
                        ViewBag.Message = "Invalid Image.";
                        return View();
                    }
                }

                _db.UpdateProfile(usrMaps.UserVMtoUser(uvm), id);
                return RedirectToAction("Profile", "Home");
            }
            else
            {
                return RedirectToAction("LogIn", "Home");
            }
        }