Exemplo n.º 1
0
        public IActionResult CreateEdit(int id = 0)
        {
            var model = new AttorneyDetailsViewModel();

            if (id != 0)
            {
                model = _context.GetAttorneyDetails(id);
            }
            else
            {
                model.Attorney = new Attorney
                {
                    ClcContribution       = 0,
                    MiaContribution       = 0,
                    LatinoMemContribution = 0,
                    IsAssigningAttorney   = false,
                    RecruitmentDate       = DateTime.Today
                };
            }
            return(View("CreateEdit", model.Attorney));
        }
Exemplo n.º 2
0
        public AttorneyDetailsViewModel GetAttorneyDetails(int id)
        {
            var viewModel = new AttorneyDetailsViewModel();
            var dbResult  = _db.Attorneys.Include(x => x.Phone).Include(x => x.Address).Include(x => x.Email).FirstOrDefault(x => x.Id == id);

            if (dbResult != null)
            {
                dbResult.AssignedCases = _db.Cases.Count(y => y.VolunteerAttorney.Id == dbResult.Id && y.Active);
                viewModel.Attorney     = dbResult;
                viewModel.CaseList     = _db.Cases
                                         .Include(x => x.LeadClient)
                                         .Where(x => x.VolunteerAttorneyId == id).Select(x => new AttorneyCasesViewModel
                {
                    Active         = x.Active,
                    CaseId         = x.Id,
                    LeadClientName = x.LeadClient.FullName,
                    Type           = x.Type
                }).ToList();
            }
            return(viewModel);
        }