Example #1
0
        public IHttpActionResult GetGoal(long id)
        {
            var b = gSvc.GetGoal(id);

            if (b == null)
            {
                return(NotFound());
            }
            return(Ok(GoalDto.FromGoal(b)));
        }
Example #2
0
        public IHttpActionResult PostGoal(Goal goal)
        {
            var uid = User.Identity.GetUserId();

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            gSvc.CreateGoal(goal, uid);
            uow.Save();

            return(CreatedAtRoute("DefaultApi", new { id = goal.ID }, GoalDto.FromGoal(goal)));
        }
Example #3
0
 // GET: api/Goals
 public IEnumerable <GoalDto> GetGoals()
 {
     return(gSvc.GetGoals().Select(b => GoalDto.FromGoal(b)));
 }