Beispiel #1
0
 public Responses.PmsSummary.GetPmsSummaryResponse GetPmsSummary(Requests.PmsSummary.GetPmsSummaryRequest request)
 {
     var pmsSummaries = new List<PmsSummary>();
     var yearNow = DateTime.Now.Year;
     pmsSummaries = DataContext.PmsSummaries.Where(x => x.Title == yearNow.ToString()).ToList();
     var response = new GetPmsSummaryResponse();
     response.PmsSummaries = pmsSummaries.MapTo<GetPmsSummaryResponse.PmsSummary>();
     return response;
 }
Beispiel #2
0
        public GetPmsSummaryResponse GetPmsSummary(int id)
        {
            var response = new GetPmsSummaryResponse();
            try
            {
                var pmsSummary = DataContext.PmsSummaries
                                            .Include(x => x.ScoreIndicators)
                                            .First(x => x.Id == id);
                response = pmsSummary.MapTo<GetPmsSummaryResponse>();
                response.IsSuccess = true;
            }
            catch (ArgumentNullException argumentNullException)
            {
                response.Message = argumentNullException.Message;
            }
            catch (InvalidOperationException invalidOperationException)
            {
                response.Message = invalidOperationException.Message;
            }

            return response;
        }