public int SignUp(User user) { user.Password = this.HashPassword(user.Password); try { _context.User.Add(user); _context.SaveChanges(); return(user.Id); } catch { return(-1); } }
public bool AddFood(int userId, Food food) { try { food.AddedById = userId; food.AddedAt = DateTime.Now; _context.Food.Add(food); _context.SaveChanges(); return(true); } catch { return(false); } }