Esempio n. 1
0
 public ActionResult Edit([Bind(Include = "Id,UserId,Time,Type")] Activity activity)
 {
     if (ModelState.IsValid)
     {
         db.Entry(activity).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(activity));
 }
Esempio n. 2
0
 public ActionResult Edit([Bind(Include = "Id,UserId,Date,Hours,Type")] Timesheet timesheet)
 {
     if (ModelState.IsValid)
     {
         db.Entry(timesheet).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(timesheet));
 }
Esempio n. 3
0
 public ActionResult UserSettings([Bind(Include = "Id,FirstName,LastName,Email,Password,ConfirmPassword,Role,WorkingHours")] User user)
 {
     if (ModelState.IsValid)
     {
         if (user.Password == null || user.ConfirmPassword == null)
         {
             User u = db.Users.Find(Convert.ToInt32(Session["UserId"]));
             user.Password        = u.Password;
             user.ConfirmPassword = u.Password;
             db.Dispose();
             db = new ClockMeContext();
         }
         else
         {
             user.Password        = Global.GetMd5Hash(user.Password);
             user.ConfirmPassword = Global.GetMd5Hash(user.ConfirmPassword);
         }
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", "Home"));
     }
     return(View(user));
 }
Esempio n. 4
0
        public ActionResult Edit(PlanningCalendar cEvent)
        {
            cEvent.UserId = Convert.ToInt32(Session["UserId"]);

            if (cEvent.Name is null)
            {
                cEvent.Name = "";
            }
            if (cEvent.Location is null)
            {
                cEvent.Location = "";
            }
            db.Entry(cEvent).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 5
0
        public ActionResult ResetPassword(User user)
        {
            if (ModelState.IsValid)
            {
                var fgInfo = db.PinManagers.Find(user.Id);
                var u      = db.Users.Find(user.Id);
                u.Password        = Global.GetMd5Hash(user.Password);
                u.ConfirmPassword = Global.GetMd5Hash(user.ConfirmPassword);

                db.PinManagers.Remove(fgInfo);
                db.Entry(u).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("ResetPasswordConfirmation"));
            }
            return(View(user));
        }