Esempio n. 1
0
        public static bool RemoveUser(this DBEntities DB, UserView userView)
        {
            User userToDelete = userView.ToUser();

            userView.RemoveAvatar();
            DB.Users.Remove(userToDelete);
            DB.SaveChanges();
            return(true);
        }
Esempio n. 2
0
        public static UserView AddUser(this DBEntities DB, UserView userView)
        {
            userView.SaveAvatar();
            User user = userView.ToUser();

            user = DB.Users.Add(user);
            DB.SaveChanges();
            return(user.ToUserView());
        }