Пример #1
0
        public ActionResult RoleSetting(FormCollection fc)
        {
            var RoleName = fc["RoleName"];

            var CheckIfAvailable = dc.tblRoleMasters.Where(w => w.RoleName == RoleName).ToList();

            if (CheckIfAvailable.Count() == 0)
            {
                tblRoleMaster obj = new tblRoleMaster();
                obj.RoleName = RoleName;
                dc.tblRoleMasters.Add(obj);
                dc.SaveChanges();
                Session["msgRole"] = "Role Added Successfully";
            }
            else
            {
                Session["msgRole"] = "Role already exist.";
            }


            //GetTimeZone();
            //GetDateTimeFormat();
            //GetWeekDays();
            return(RedirectToAction("AccessMaster"));
        }
Пример #2
0
        public HttpResponseMessage Post([FromBody] tblRoleMaster value)
        {
            int intRoleID = benmoonDB.tblRoleMasters.Max(x => x.RoleID) + 1;

            value.RoleID     = intRoleID;
            value.CommandID  = 1;
            value.CreateDate = DateTime.Now;
            value.UpdateDate = DateTime.Now;
            value.CreateIP   = "";
            value.UpdateIP   = "";

            benmoonDB.tblRoleMasters.Add(value);
            return(ToJson(benmoonDB.SaveChanges()));
        }
Пример #3
0
        public HttpResponseMessage Put(int id, [FromBody] tblRoleMaster value)
        {
            benmoonDB.tblRoleMasters.Attach(value);
            value.CommandID  = 2;
            value.UpdateDate = DateTime.Now;
            value.UpdateIP   = "";

            benmoonDB.Entry(value).Property(x => x.RoleName).IsModified   = true;
            benmoonDB.Entry(value).Property(x => x.RoleDesc).IsModified   = true;
            benmoonDB.Entry(value).Property(x => x.IsActive).IsModified   = true;
            benmoonDB.Entry(value).Property(x => x.CommandID).IsModified  = true;
            benmoonDB.Entry(value).Property(x => x.UpdateDate).IsModified = true;
            benmoonDB.Entry(value).Property(x => x.UpdateIP).IsModified   = true;
            return(ToJson(benmoonDB.SaveChanges()));
        }