Exemplo n.º 1
0
        public void UpdateRecord(FeeRecord fees)
        {
            db.FeeRecords.Attach(fees);
            var Update = db.Entry(fees);

            Update.Property(x => x.StudenName).IsModified         = true;
            Update.Property(x => x.FatherName).IsModified         = true;
            Update.Property(x => x.classID).IsModified            = true;
            Update.Property(x => x.Section).IsModified            = true;
            Update.Property(x => x.RollNo).IsModified             = true;
            Update.Property(x => x.IssueDate).IsModified          = true;
            Update.Property(x => x.DueDate).IsModified            = true;
            Update.Property(x => x.UniversityCampusID).IsModified = true;
            Update.Property(x => x.PaperFund).IsModified          = true;
            Update.Property(x => x.Misc).IsModified                = true;
            Update.Property(x => x.BasicFee).IsModified            = true;
            Update.Property(x => x.AdmissionFee).IsModified        = true;
            Update.Property(x => x.PayableInDueDate).IsModified    = true;
            Update.Property(x => x.PayableAfterDueDate).IsModified = true;
            //Update.Property(x => x.Class).IsModified = true;

            // Update.Property(x => x.Date).IsModified = true;
            Update.Property(x => x.ID).IsModified      = true;
            Update.Property(x => x.Section).IsModified = true;
            // Update.Property(x => x.submittedFee).IsModified = true;
            //  Update.Property(x => x.IsDelete).IsModified = true;
            db.SaveChanges();
        }
        public void Update(Teacher tchr)
        {
            db1.Teachers.Attach(tchr);
            var Update = db1.Entry(tchr);

            Update.Property(x => x.Address).IsModified       = true;
            Update.Property(x => x.BasicSalary).IsModified   = true;
            Update.Property(x => x.CellNo).IsModified        = true;
            Update.Property(x => x.CityID).IsModified        = true;
            Update.Property(x => x.CountryID).IsModified     = true;
            Update.Property(x => x.Description).IsModified   = true;
            Update.Property(x => x.DesignationID).IsModified = true;
            Update.Property(x => x.EndDate).IsModified       = true;
            Update.Property(x => x.MaritalStatus).IsModified = true;
            Update.Property(x => x.FirstName).IsModified     = true;
            Update.Property(x => x.ID).IsModified            = true;
            Update.Property(x => x.LastName).IsModified      = true;
            Update.Property(x => x.Religion).IsModified      = true;
            Update.Property(x => x.StartDate).IsModified     = true;

            db1.SaveChanges();
        }
        public ActionResult ChangePassword(string old, string newpass, string confrim)
        {
            if (old != null && old != "" && newpass != null && newpass != "" && confrim != null && confrim != "")
            {
                if (newpass == confrim)
                {
                    HttpCookie cookie = HttpContext.Request.Cookies["AdminCookies"];
                    int        ID     = Convert.ToInt32(cookie.Values["ID"]);
                    User       usr    = new UserModel().GetUserByID(ID);
                    if (usr.Password == old)
                    {
                        usr.Password = newpass;
                        var user = new User()
                        {
                            ID       = ID,
                            Password = newpass
                        };
                        using (var dbpass = new AlumniEntities())
                        {
                            try
                            {
                                dbpass.Users.Attach(user);
                                dbpass.Entry(user).Property(x => x.Password).IsModified = true;
                                dbpass.SaveChanges();
                                TempData["AlertTask"] = "Password Successfully Update";
                                return(RedirectToAction("DashboardIndex", "user"));
                            }
                            catch
                            {
                            }
                        }
                    }
                    else
                    {
                        ViewBag.ErrorMsg = "oldpass";
                    }
                }
                else
                {
                    ViewBag.ErrorMsg = "PasswordsNotMatch";
                }
            }
            else
            {
                ViewBag.ErrorMsg = "CannotEmpty";
            }


            return(View());
        }
        public void Update(User user)
        {
            try
            {
                db.Users.Attach(user);
                var Update = db.Entry(user);
                Update.Property(x => x.FullName).IsModified  = true;
                Update.Property(x => x.UserName).IsModified  = true;
                Update.Property(x => x.Email).IsModified     = true;
                Update.Property(x => x.Password).IsModified  = true;
                Update.Property(x => x.Address).IsModified   = true;
                Update.Property(x => x.ContactNo).IsModified = true;
                if (user.Image != "NoImage.jpg")
                {
                    Update.Property(x => x.Image).IsModified = true;
                }
                Update.Property(x => x.IsActive).IsModified = true;

                db.SaveChanges();
            }
            catch (Exception ex)
            {
            }
        }