Exemple #1
0
        public string DeleteItemByItemId(int itemId)
        {
            var item = db.Items.Find(itemId);

            if (item != null)
            {
                db.Entry(item).State = EntityState.Deleted;
                db.SaveChanges();
                return("Selected Employee record deleted sucessfully");
            }
            return("Invalid Operation");
        }
Exemple #2
0
        public string DeleteEmployeeById(int id)
        {
            Employee employee = db.Employees.Find(id);

            if (employee != null)
            {
                employee.DelFlag         = 1;
                employee.LeaveAt         = DateTime.Now;
                db.Entry(employee).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                return("Selected Employee record deleted sucessfully");
            }
            return("Invalid Operation");
        }
 public ActionResult Edit([Bind(Include = "Id,Type,Acid_Id,Acid_Password")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
        public virtual int Update(TObject TObject)
        {
            var entry = Context.Entry(TObject);

            DbSet.Attach(TObject);
            entry.State = EntityState.Modified;
            if (!shareContext)
            {
                return(Context.SaveChanges());
            }
            return(0);
        }
        public IActionResult ApproveUser(int userId)
        {
            var user = db.Users.SingleOrDefault(_user => _user.Id == userId);

            user.IsApproved = true;

            db.Entry(user).State = EntityState.Modified;

            db.SaveChanges();

            return(Redirect("/backend/users/pending"));
        }
 public IActionResult Edit(Models.Role role)
 {
     db.Entry(role).State = EntityState.Modified;
     db.SaveChanges();
     return(Redirect("/backend/roles"));
 }