public void DeleteUser(SPAProjectManager.Entities.Users user) { User ur = new User { User_ID = user.UserID }; _projectManager.Entry(ur).State = EntityState.Deleted; _projectManager.SaveChanges(); }
public void UpdateUser(SPAProjectManager.Entities.Users user) { var ur = _projectManager.Users.Where(x => x.User_ID == user.UserID).FirstOrDefault(); if (ur != null) { ur.User_ID = user.UserID; ur.FirstName = user.FirstName; ur.LastName = user.LastName; ur.Employee_ID = Convert.ToInt32(user.EmployeeID); _projectManager.SaveChanges(); } }
public void AddUser(SPAProjectManager.Entities.Users user) { User ur = new User { //User_ID = user.UserID, FirstName = user.FirstName, LastName = user.LastName, Employee_ID = (Convert.ToInt32(user.EmployeeID)) }; _projectManager.Users.Add(ur); _projectManager.SaveChanges(); }
public IHttpActionResult DeleteUser([FromBody] SPAProjectManager.Models.Users user) { try { SPAProjectManager.Entities.Users usr = new SPAProjectManager.Entities.Users { UserID = user.UserID, //FirstName = user.FirstName, //LastName = user.LastName, //EmployeeID = user.EmployeeID }; _userBL.DeleteUser(usr); return(Ok()); } catch (Exception) { return(InternalServerError()); } }
public void DeleteUser(SPAProjectManager.Entities.Users user) { var userBL = new UsersBL(mockContext); userBL.DeleteUser(user); }