public bool CreateNewUser([FromBody] Users newUser)
        {
            NutritionsDBContext context = new NutritionsDBContext();

            context.Users.Add(newUser);
            context.SaveChanges();
            return(true);
        }
        public bool CreateNewFood([FromBody] Foods newFood)
        {
            NutritionsDBContext context = new NutritionsDBContext();

            context.Foods.Add(newFood);
            context.SaveChanges();
            return(true);
        }
        public bool CreateNewEvent([FromBody] Events newEvent)
        {
            NutritionsDBContext context = new NutritionsDBContext();

            context.Events.Add(newEvent);
            context.SaveChanges();
            return(true);
        }
        public Events ModifyEvent(int eventID, Events updatedEvent)
        {
            NutritionsDBContext context = new NutritionsDBContext();
            Events eventVariable        = context.Events.Find(eventID);

            if (eventVariable == null)
            {
                return(null);
            }
            eventVariable.EventDate = updatedEvent.EventDate;
            context.SaveChanges();

            return(eventVariable);
        }
        public bool DeleteUser(int userID)
        {
            NutritionsDBContext context = new NutritionsDBContext();
            Users userVariable          = context.Users.Find(userID);

            if (userVariable == null)
            {
                return(false);
            }

            context.Users.Remove(userVariable);
            context.SaveChanges();

            return(true);
        }
        public bool DeleteFood(int foodID)
        {
            NutritionsDBContext context = new NutritionsDBContext();
            Foods foodVariable          = context.Foods.Find(foodID);

            if (foodVariable == null)
            {
                return(false);
            }

            context.Foods.Remove(foodVariable);
            context.SaveChanges();

            return(true);
        }
        public bool DeleteEvent(int eventID)
        {
            NutritionsDBContext context = new NutritionsDBContext();
            Events eventVariable        = context.Events.Find(eventID);

            if (eventVariable == null)
            {
                return(false);
            }

            context.Events.Remove(eventVariable);
            context.SaveChanges();

            return(true);
        }
        public Users ModifyUser(int userID, [FromBody] Users updatedUser)
        {
            NutritionsDBContext context = new NutritionsDBContext();
            Users userVariable          = context.Users.Find(userID);

            // Are we able to find user with given ID?
            if (userVariable == null)
            {
                return(null);
            }

            // modification takes places
            userVariable.UserName = updatedUser.UserName;
            userVariable.UserBmi  = updatedUser.UserBmi;
            context.SaveChanges();

            return(userVariable);
        }