public async Task<IActionResult> Edit(int id, [Bind("Id,nicNo,patientName,DoctorName,LabStatus,LabType,DoctorStatus,LabReport,date,labNo,SpecialistName,description")] LabReportRequest labReportRequest)
        {
            if (id != labReportRequest.Id)
            {
                return NotFound();
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(labReportRequest);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LabReportRequestExists(labReportRequest.Id))
                    {
                        return NotFound();
                    }
                    else
                    {
                        throw;
                    }
                }
                return RedirectToAction(nameof(Index));
            }
            return View(labReportRequest);
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,ReportId, nicNo,patientName,DoctorName,LabStatus,LabType,DoctorStatus,LabReport,date,labNo,SpecialistName,description")] LabReportRequest labReportRequest)
        {
            // make the report ready
            labReportRequest.LabStatus = "Ready";


            if (id != labReportRequest.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(labReportRequest);
                    await _context.SaveChangesAsync();
                    await Recived_Report_Count_Update();
                }
                catch (DbUpdateConcurrencyException)
                {
                    //if (!LabReportRequestExists(labReportRequest.Id))
                    //{
                    //    return NotFound();
                    //}
                    //else
                    //{
                    //    throw;
                    //}
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(labReportRequest));
        }
 public async Task<IActionResult> Create([Bind("Id,nicNo,patientName,DoctorName,LabStatus,LabType,DoctorStatus,LabReport,date,labNo,SpecialistName,description")] LabReportRequest labReportRequest)
 {
     labReportRequest.LabStatus = "Pending";
     if (ModelState.IsValid)
     {
         _context.Add(labReportRequest);
         await _context.SaveChangesAsync();
         return RedirectToAction(nameof(Index));
     }
     return View(labReportRequest);
 }
        public async Task <LabReportRequest> SearchLab(int?id)
        {
            LabReportRequest labReportRequest = new LabReportRequest();

            if (id == null)
            {
                //  return NotFound();
            }

            ViewBag.a = 30;

            labReportRequest = await _context.LabReportRequest
                               .SingleOrDefaultAsync(m => m.ReportId == id);

            if (labReportRequest == null)
            {
            }


            // return View(labReportRequest);
            return(labReportRequest);
        }