Esempio n. 1
0
        /// <summary>
        /// Добавяне на бюлетин към лице
        /// </summary>
        /// <param name="personId"></param>
        /// <returns></returns>
        public IActionResult AddBulletin(int personId)
        {
            var bulletin = service.CasePersonSentenceBulletin_GetByIdPerson(personId);

            if (bulletin == null)
            {
                SetViewBagBulletin(personId);

                var      caseSentence = service.CasePersonSentence_GetByPerson(personId);
                var      caseModel    = service.GetById <Case>(caseSentence.CaseId);
                var      caseLawUnit  = lawUnitService.GetJudgeReporter(caseSentence.CaseId);
                DateTime?birthDay     = caseSentence.CasePerson.UicTypeId == NomenclatureConstants.UicTypes.EGN ?
                                        Utils.Validation.GetBirthDayFromEgn(caseSentence.CasePerson.Uic) : null;

                var model = new CasePersonSentenceBulletinEditVM()
                {
                    CasePersonId        = personId,
                    CaseId              = caseSentence.CaseId,
                    CourtId             = userContext.CourtId,
                    CaseTypeId          = caseModel.CaseTypeId,
                    SentenceDescription = caseSentence.Description.Replace(Environment.NewLine, "<p>"),
                    LawUnitSignId       = caseLawUnit != null ? caseLawUnit.LawUnitId : 0,
                };
                if (birthDay != null)
                {
                    model.BirthDay = (DateTime)birthDay;
                }
                return(View(nameof(EditBulletin), model));
            }
            else
            {
                return(RedirectToAction(nameof(EditBulletin), new { id = bulletin.Id }));
            }
        }