Exemplo n.º 1
0
        public int Delete(int ID)
        {
            tblSection tb = _db.tblSections.Where(s => s.Section_Id == ID).FirstOrDefault();

            _db.tblSections.Remove(tb);
            return(_db.SaveChanges());
        }
Exemplo n.º 2
0
        public int Update(SectionViewModel svm)
        {
            tblSection tb      = _db.tblSections.Where(s => s.Section_Id == svm.Id).FirstOrDefault();
            var        secName = tb.Sec_Name;

            tb.Sec_Name = svm.Sec_Name;
            _db.SaveChanges();
            tblMainLog tml       = new tblMainLog();
            var        principal = System.Security.Claims.ClaimsPrincipal.Current;
            string     Name      = principal.FindFirst(ClaimsIdentity.DefaultNameClaimType).Value;

            str             = "Section Name Updated from '" + secName + "' " + "to '" + svm.Sec_Name + "' " + "by Admin";
            tml.Description = str;
            tml.AdminName   = Name;
            tml.Date        = System.DateTime.Now;
            tml.EntityId    = 8;
            tml.ItemId      = tb.Section_Id;
            _db.tblMainLogs.Add(tml);
            return(_db.SaveChanges());
        }
Exemplo n.º 3
0
        public int Add(SectionViewModel svm)
        {
            tblSection tb = new tblSection();

            tb.Sec_Name = svm.Sec_Name;
            _db.tblSections.Add(tb);
            _db.SaveChanges();
            tblMainLog tml       = new tblMainLog();
            var        principal = System.Security.Claims.ClaimsPrincipal.Current;
            string     Name      = principal.FindFirst(ClaimsIdentity.DefaultNameClaimType).Value;

            str             = "New Section '" + svm.Sec_Name + "' " + "Added by Admin";
            tml.Description = str;
            tml.AdminName   = Name;
            tml.Date        = System.DateTime.Now;
            tml.EntityId    = 8;
            tml.ItemId      = tb.Section_Id;
            _db.tblMainLogs.Add(tml);
            return(_db.SaveChanges());
        }