Beispiel #1
0
        public bool DeleteUser(int id)
        {
            bool retVal = false;

            using (UserStoryEntities context = new UserStoryEntities())
            {
                context.Users.Remove(context.Users.Where(u => u.UserId == id).SingleOrDefault());
                context.SaveChanges();
                retVal = true;
            }
            return(retVal);
        }
Beispiel #2
0
        public bool UpdateUser(IUserDTO userDTO)
        {
            bool retVal = false;

            using (UserStoryEntities context = new UserStoryEntities())
            {
                User user = context.Users.Where(u => u.UserId == userDTO.UserId).SingleOrDefault();
                EntityConverter.FillEntityFromDTO(userDTO, user);
                context.SaveChanges();
                retVal = true;
            }

            return(retVal);
        }
Beispiel #3
0
        public int InsertUser(IUserDTO userDTO)
        {
            int retVal = -1;

            using (UserStoryEntities context = new UserStoryEntities())
            {
                User user = new User();
                EntityConverter.FillEntityFromDTO(userDTO, user);
                context.Users.Add(user);
                context.SaveChanges();
                retVal = user.UserId;
            }
            return(retVal);
        }