Esempio n. 1
0
        public async Task <IHttpActionResult> PutGroupGoals(int id, GroupGoals groupGoals)
        {
            if (id != groupGoals.GroupGoalId)
            {
                return(BadRequest());
            }

            // Llamar Update de BS
            try
            {
                bs.Updated(groupGoals);
            }
            catch (Exception ee)
            {
                if (!GroupGoalsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
        public async Task <IHttpActionResult> GetGroupGoals(int id)
        {
            GroupGoals groupGoals = bs.GetOneById(id);

            if (groupGoals == null)
            {
                return(NotFound());
            }

            return(Ok(groupGoals));
        }
Esempio n. 3
0
        public async Task <IHttpActionResult> PostGroupGoals(GroupGoals groupGoals)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            // LLamar BS hacer insert
            bs.Insert(groupGoals);
            GroupGoals newGoal = bs.SearchByName(groupGoals.GoalName).LastOrDefault();

            return(CreatedAtRoute("DefaultApi", new { id = newGoal.GroupGoalId }, newGoal));
        }