예제 #1
0
        public int Delete(int ID)
        {
            tblFaculty tb = _db.tblFaculties.Where(f => f.Faculty_Id == ID).FirstOrDefault();

            _db.tblFaculties.Remove(tb);
            return(_db.SaveChanges());
        }
예제 #2
0
        public int Update(FacultyViewModel fvm)
        {
            tblFaculty tb      = _db.tblFaculties.Where(f => f.Faculty_Id == fvm.Id).FirstOrDefault();
            var        facName = tb.Faculty_Name;

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

            str             = "Faculty Name Updated from '" + facName + "' " + "to '" + fvm.Faculty_Name + "' " + "by Admin";
            tml.Description = str;
            tml.AdminName   = Name;
            tml.Date        = System.DateTime.Now;
            tml.EntityId    = 6;
            tml.ItemId      = tb.Faculty_Id;
            _db.tblMainLogs.Add(tml);
            return(_db.SaveChanges());
        }
예제 #3
0
        public int Add(FacultyViewModel fvm)
        {
            tblFaculty tb = new tblFaculty();

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

            str             = "New Faculty '" + fvm.Faculty_Name + "' " + "Added by Admin";
            tml.Description = str;
            tml.AdminName   = Name;
            tml.Date        = System.DateTime.Now;
            tml.EntityId    = 6;
            tml.ItemId      = tb.Faculty_Id;
            _db.tblMainLogs.Add(tml);
            return(_db.SaveChanges());
        }