public string UpdateUser(User user)
 {
     bool updated = repository.Update(user);
     if (updated)
         return "User with id = " + user.id + " updated successfully";
     return "Unable to update user with id = " + user.id;
 }
 public User Add(User item)
 {
     if (item == null)
         throw new ArgumentNullException("item");
     item.id = counter++;
     books.Add(item);
     return item;
 }
        public bool Update(User item)
        {
            if (item == null)
                throw new ArgumentNullException("item");

            int idx = books.FindIndex(b => b.id == item.id);
            if (idx == -1)
                return false;

            books.RemoveAt(idx);
            books.Add(item);
            return true;
        }
 public string AddUser(User user)
 {
     User newUser = repository.Add(user);
     return "id=" + newUser.id;
 }