예제 #1
0
        public HttpResponseMessage GetHistoryObjectives([FromUri] string id)
        {
            try
            {
                var objectives = _objectiveService.GetHistoryObjectives(id).ToList();
                if (objectives.Count == 0)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, new List <ObjectiveHistoryDto>()
                    {
                        new ObjectiveHistoryDto()
                        {
                            Name = "No past objectives :(",
                            Description = string.Empty,
                        }
                    }));
                }

                return(Request.CreateResponse(HttpStatusCode.OK, objectives));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }