public HttpResponseMessage Resources() { HttpResponseMessage response = null; Domain.NoteResources mNoteResources = new NoteResources(); try { mNoteResources = noteService.GetResources(); response = Request.CreateResponse(HttpStatusCode.OK, mNoteResources); } catch (Exception ex) { response = Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } return(response); }
public NoteResources GetResources() { NoteResources mNoteResourcesList = new NoteResources(); mNoteResourcesList.hungers = Enum.GetValues(typeof(Hunger)) .Cast <Hunger>() .Select(d => new ObjectNode() { id = d.ToString().ToUpper(), name = StringExtensions.FirstCharToUpper(d.ToString()) }) .ToList(); mNoteResourcesList.thirsts = Enum.GetValues(typeof(Thirst)) .Cast <Thirst>() .Select(d => new ObjectNode() { id = d.ToString().ToUpper(), name = StringExtensions.FirstCharToUpper(d.ToString()) }) .ToList(); mNoteResourcesList.sleeps = Enum.GetValues(typeof(Sleep)) .Cast <Sleep>() .Select(d => new ObjectNode() { id = d.ToString().ToUpper(), name = StringExtensions.FirstCharToUpper(d.ToString()) }) .ToList(); mNoteResourcesList.urines = Enum.GetValues(typeof(Urine)) .Cast <Urine>() .Select(d => new ObjectNode() { id = d.ToString().ToUpper(), name = StringExtensions.FirstCharToUpper(d.ToString()) }) .ToList(); mNoteResourcesList.weightEvolutions = Enum.GetValues(typeof(WeightEvolution)) .Cast <WeightEvolution>() .Select(d => new ObjectNode() { id = d.ToString().ToUpper(), name = StringExtensions.FirstCharToUpper(d.ToString()) }) .ToList(); mNoteResourcesList.depositions = Enum.GetValues(typeof(Deposition)) .Cast <Deposition>() .Select(d => new ObjectNode() { id = d.ToString().ToUpper(), name = StringExtensions.FirstCharToUpper(d.ToString()) }) .ToList(); mNoteResourcesList.cardiovascularSymptom = Enum.GetValues(typeof(CardiovascularSymptom)) .Cast <CardiovascularSymptom>() .Select(d => new ObjectNode() { id = d.ToString().ToUpper(), name = StringExtensions.FirstCharToUpper(d.ToString()) }) .ToList(); mNoteResourcesList.medicines = Enum.GetValues(typeof(Infrastructure.Common.Medicine)) .Cast <Infrastructure.Common.Medicine>() .Select(d => new ObjectNode() { id = d.ToString().ToUpper(), name = StringExtensions.FirstCharToUpper(d.ToString()) }) .ToList(); mNoteResourcesList.backgrounds = Enum.GetValues(typeof(Infrastructure.Common.Background)) .Cast <Infrastructure.Common.Background>() .Select(d => new ObjectNode() { id = d.ToString().ToUpper(), name = StringExtensions.FirstCharToUpper(d.ToString()) }) .ToList(); mNoteResourcesList.physicalActivities = Enum.GetValues(typeof(Infrastructure.Common.PhysicalActivity)) .Cast <Infrastructure.Common.PhysicalActivity>() .Select(d => new ObjectNode() { id = d.ToString().ToUpper(), name = StringExtensions.FirstCharToUpper(d.ToString()) }) .ToList(); mNoteResourcesList.sexes = Enum.GetValues(typeof(Infrastructure.Common.Sex)) .Cast <Infrastructure.Common.Sex>() .Select(d => new ObjectNode() { id = d.ToString().ToUpper(), name = StringExtensions.FirstCharToUpper(d.ToString()) }) .ToList(); return(mNoteResourcesList); }