Esempio n. 1
0
        public void CreateUser(User user)
        {
            ProjectManagementContext userContext = new ProjectManagementContext();
            var mapper     = mapperConfig.CreateMapper();
            var userEntity = mapper.Map <UserEntity>(user);

            userContext.Users.Add(userEntity);
            userContext.SaveChanges();
        }
Esempio n. 2
0
        public void UpdateUser(User user)
        {
            ProjectManagementContext userContext = new ProjectManagementContext();
            var userData = userContext.Users.Find(user.UserID);

            if (userData != null)
            {
                userData.FirstName  = user.FirstName;
                userData.LastName   = user.LastName;
                userData.EmployeeID = user.EmployeeID;
                userContext.SaveChanges();
            }
        }