コード例 #1
0
        public ActionResult ModifyBranch(HaiBranch branch)
        {
            if (!Utitl.CheckUser(db, User.Identity.Name, "ManageStaff", 1))
            {
                return(RedirectToAction("relogin", "home"));
            }

            var branchCheck = db.HaiBranches.Find(branch.Id);

            if (branchCheck == null)
            {
                return(RedirectToAction("error", "home"));
            }


            branchCheck.Name        = branch.Name;
            branchCheck.Code        = branch.Code;
            branchCheck.AreaId      = branch.AreaId;
            branchCheck.AddressInfo = branch.AddressInfo;
            branchCheck.Notes       = branch.Notes;

            db.Entry(branchCheck).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();

            return(RedirectToAction("modifybranch"));
        }
コード例 #2
0
        public ActionResult CreateBrand(HaiBranch branch)
        {
            if (!Utitl.CheckUser(db, User.Identity.Name, "ManageStaff", 1))
            {
                return(RedirectToAction("relogin", "home"));
            }
            db.HaiBranches.Add(branch);
            db.SaveChanges();

            return(RedirectToAction("createbrand", "haistaff"));
        }