コード例 #1
0
        public void DeleteUser(SPAProjectManager.Entities.Users user)
        {
            User ur = new User
            {
                User_ID = user.UserID
            };

            _projectManager.Entry(ur).State = EntityState.Deleted;
            _projectManager.SaveChanges();
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
        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();
        }
コード例 #4
0
 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());
     }
 }
コード例 #5
0
        public void DeleteUser(SPAProjectManager.Entities.Users user)
        {
            var userBL = new UsersBL(mockContext);

            userBL.DeleteUser(user);
        }