public IHttpActionResult GetGoal(long id) { var b = gSvc.GetGoal(id); if (b == null) { return(NotFound()); } return(Ok(GoalDto.FromGoal(b))); }
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))); }
// GET: api/Goals public IEnumerable <GoalDto> GetGoals() { return(gSvc.GetGoals().Select(b => GoalDto.FromGoal(b))); }