Beispiel #1
0
        public IActionResult Create(int personAntiSocialBehaviourId)
        {
            var personAntiSocialBehaviour         = _customerFacadeApiClient.GetPersonAntiSocialBehaviour(personAntiSocialBehaviourId).Result;
            var personAntiSocialBehaviourCaseNote = new PersonAntiSocialBehaviourCaseNoteDto
            {
                PersonAntiSocialBehaviourId = personAntiSocialBehaviourId,
                PersonAntiSocialBehaviour   = personAntiSocialBehaviour,
                ActionDate = DateTime.Now,
                ActionTimeSelectListItems = SelectedListHelper.GetTimeIntervalForCalendar()
            };

            PopulateLookupFields(personAntiSocialBehaviourCaseNote);
            return(PartialView("Edit", personAntiSocialBehaviourCaseNote));
        }
Beispiel #2
0
        private void PopulateLookupFields(PersonAntiSocialBehaviourCaseNoteDto personAntiSocialBehaviourDto)
        {
            var lookups = _lookupApiClient.GetLookupUsingOdata(new List <string> {
                nameof(LookupDto.AntiSocialBehaviourCaseStatuses), nameof(LookupDto.AntiSocialBehaviourCaseClosureReasons), nameof(LookupDto.AntiSocialBehaviourTypes)
            }).Result;
            var model = lookups.value.FirstOrDefault();

            if (model != null)
            {
                var caseStatuses       = model.AntiSocialBehaviourCaseStatuses?.ConvertAll(x => (BaseLookupDto)x);
                var caseTypes          = model.AntiSocialBehaviourTypes?.ConvertAll(x => (BaseLookupDto)x);
                var caseClosureReasons = model.AntiSocialBehaviourCaseClosureReasons?.ConvertAll(x => (BaseLookupDto)x);
                personAntiSocialBehaviourDto.PersonAntiSocialBehaviour.CaseStatusSelectListItems =
                    SelectedListHelper.GetSelectListForItems(caseStatuses, personAntiSocialBehaviourDto.PersonAntiSocialBehaviour.CaseStatusId?.ToString());
                personAntiSocialBehaviourDto.PersonAntiSocialBehaviour.CaseTypeSelectListItems =
                    SelectedListHelper.GetSelectListForItems(caseTypes, personAntiSocialBehaviourDto.PersonAntiSocialBehaviour.CaseStatusId?.ToString());
                personAntiSocialBehaviourDto.PersonAntiSocialBehaviour.CaseClosureReasonSelectListItems =
                    SelectedListHelper.GetSelectListForItems(caseClosureReasons, personAntiSocialBehaviourDto.PersonAntiSocialBehaviour.CaseStatusId?.ToString());
            }
            personAntiSocialBehaviourDto.ActionTimeSelectListItems = SelectedListHelper.GetTimeIntervalForCalendar(personAntiSocialBehaviourDto.ActionTime);
            personAntiSocialBehaviourDto.ActionTime = personAntiSocialBehaviourDto.ActionTimeSelectListItems.First(x => x.Selected).Value;
        }