Example #1
0
        public static Domain.Cases.Case Case(Models.Case entity, bool skipPatientMap = false)
        {
            var c = new Domain.Cases.Case();

            c.DateCreated          = entity.DateCreated;
            c.GeneratingReferralID = entity.CaseGeneratingReferralID;
            c.HasAssessment        = entity.CaseHasAssessment;
            c.HasIntake            = entity.CaseHasIntake;
            c.HasPrescription      = entity.CaseHasPrescription;
            c.ID = entity.ID;
            c.RequiredHoursNotes    = entity.CaseRequiredHoursNotes;
            c.RequiredServicesNotes = entity.CaseRequiredServicesNotes;
            c.StartDate             = entity.CaseStartDate;
            c.Status                   = (Domain.Cases.CaseStatus)entity.CaseStatus;
            c.StatusNotes              = entity.CaseStatusNotes;
            c.StatusReason             = (Domain.Cases.CaseStatusReason)entity.CaseStatusReason;
            c.DefaultServiceLocationID = entity.DefaultServiceLocationID;

            c.NeedsStaffing    = entity.CaseNeedsStaffing;
            c.NeedsRestaffing  = entity.CaseNeedsRestaffing;
            c.RestaffingReason = entity.CaseRestaffingReason;

            if (entity.DefaultServiceLocationID.HasValue)
            {
                c.DefaultServiceLocation = new Services.ServicesService().GetActiveServiceLocations().Where(x => x.ID == c.DefaultServiceLocationID).FirstOrDefault();
            }

            if (!skipPatientMap)
            {
                c.Patient = Mappings.PatientMappings.Patient(entity.Patient);
            }

            return(c);
        }
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var newCase = new Models.Case();

            if (await TryUpdateModelAsync <Models.Case>(
                    newCase,
                    "case",
                    c => c.CaseNumber, c => c.PatientAge, c => c.TumourSize, c => c.SlideURL))
            {
                try
                {
                    await _caseRepository.AddAsync(newCase);
                }
                catch (DbUpdateException e)
                {
                    ModelState.AddModelError("", e.InnerException.Message);
                    return(Page());
                }

                return(RedirectToPage("./Index"));
            }

            return(Page());
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Case = await _caseRepository.GetByIdAsync(id.Value);

            if (Case != null)
            {
                await _caseRepository.DeleteAsync(Case);
            }

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Case = await _caseRepository.GetByIdAsync(id.Value);

            if (Case == null)
            {
                return(NotFound());
            }

            return(Page());
        }
 public IActionResult CaseDetails(int CaseNumber)
 {
     Models.Case cs = new Models.Case(Case.Get(CaseNumber));
     return(View(cs));
 }
Example #6
0
 public CaseViewModel()
 {
     Order   = new Models.Order();
     Case    = new Models.Case();
     Charges = new List <Charge>();
 }