public async Task <IActionResult> Edit(int id, [Bind("Id,DepartmentName,Patients")] Department department)
        {
            if (id != department.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(department);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DepartmentExists(department.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(department));
        }
示例#2
0
        public async Task <IActionResult> PutDose([FromRoute] int id, [FromBody] Dose dose)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != dose.ID)
            {
                return(BadRequest());
            }

            _context.Entry(dose).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DoseExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#3
0
        public async Task <IActionResult> cal(Invoice invoice)
        {
            if (ModelState.IsValid)
            {
                //var patientdetails = new PatientDetails()
                //{
                //    Id=Convert.ToInt32(invoice.PatienID),
                //    avalablity= "checked_out",
                //    checkedout=invoice.Date,
                //    NicNo="",
                //    Wardno="",
                //    Address="",
                //    telephone=0,
                //    patientName=""


                //};



                _context.Add(invoice);

                //_context.Patients.Update(patientdetails);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(invoice));
        }
示例#4
0
        public async Task <IActionResult> Create(Patient patient)
        {
            if (ModelState.IsValid)
            {
                if (patient.imgFile != null)
                {
                    string ext = Path.GetExtension(patient.imgFile.FileName).ToLower();
                    if (ext == ".jpg" || ext == ".png" || ext == ".mp4")
                    {
                        string fileName = Path.Combine(_Host.WebRootPath, "images\\patient", patient.imgFile.FileName);
                        using (var fileStream = new FileStream(fileName, FileMode.Create))
                        {
                            patient.imgFile.CopyTo(fileStream);
                            patient.Photo = "\\images\\patient\\" + patient.imgFile.FileName;
                        }
                    }
                }

                _context.Add(patient);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(patient));
        }
示例#5
0
        public async Task <IActionResult> PutBeds(int id, Beds beds)
        {
            if (id != beds.BedId)
            {
                return(BadRequest());
            }

            _context.Entry(beds).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BedsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#6
0
        public async Task <IActionResult> PutPriscriptions(int id, Priscriptions priscriptions)
        {
            if (id != priscriptions.PriscriptionId)
            {
                return(BadRequest());
            }

            _context.Entry(priscriptions).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PriscriptionsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#7
0
        public async Task <IActionResult> PutAssistant(int id, Assistant assistant)
        {
            if (id != assistant.AssistantId)
            {
                return(BadRequest());
            }

            _context.Entry(assistant).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AssistantExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#8
0
        public async Task <IActionResult> PutHealthcareAssistents(int id, HealthcareAssistents healthcareAssistents)
        {
            if (id != healthcareAssistents.HealthcareAssistentId)
            {
                return(BadRequest());
            }

            _context.Entry(healthcareAssistents).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HealthcareAssistentsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#9
0
        public async Task <IActionResult> PutDoctor(int id, Doctor doctor)
        {
            if (id != doctor.DoctorId)
            {
                return(BadRequest());
            }

            _context.Entry(doctor).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DoctorExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> Create(Employee employee)
        {
            if (ModelState.IsValid)
            {
                if (employee.imgFile != null)
                {
                    string ext = Path.GetExtension(employee.imgFile.FileName).ToLower();
                    if (ext == ".jpg" || ext == ".png")
                    {
                        string fileName = Path.Combine(_Host.WebRootPath, "images\\employee", employee.imgFile.FileName);
                        using (var fileStream = new FileStream(fileName, FileMode.Create))
                        {
                            employee.imgFile.CopyTo(fileStream);
                            employee.Photo = "/images/employee/" + employee.imgFile.FileName;
                        }
                    }
                }


                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmCategoryID"]  = new SelectList(_context.EmployeeCategorie, "Id", "Name", employee.EmCategoryID);
            ViewData["DeptID"]        = new SelectList(_context.Department, "Id", "Details", employee.DeptID);
            ViewData["DesignationId"] = new SelectList(_context.Designation, "Id", "Id", employee.DesignationId);
            return(View(employee));
        }
示例#11
0
        public async Task <IActionResult> PutMedicin(int id, Medicin medicin)
        {
            if (id != medicin.MedicinId)
            {
                return(BadRequest());
            }

            _context.Entry(medicin).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MedicinExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        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));
        }
示例#13
0
        public async Task <Doctor> AddDoctor(Doctor doctor)
        {
            var newDoctor = await db.Doctors.AddAsync(doctor);

            await db.SaveChangesAsync();

            return(newDoctor.Entity);
        }
示例#14
0
        public async Task <bool> Create(NewsDto newsDto)
        {
            var entity = newsDto.ToEntity();

            _context.News.Add(entity);
            await _context.SaveChangesAsync();

            return(true);
        }
示例#15
0
        public async Task <bool> Create(EmployeeDto employeeDto)
        {
            var entity = employeeDto.ToEntity();

            _context.Employees.Add(entity);
            _context.Registrations.AddRange(entity.Registrations);
            await _context.SaveChangesAsync();

            return(true);
        }
示例#16
0
        public async Task <bool> Create(PatientDto patientDto)
        {
            var entity = patientDto.ToEntity();

            _context.Patients.Add(entity);
            _context.Registrations.AddRange(entity.Registrations);
            await _context.SaveChangesAsync();

            return(true);
        }
        public async Task <bool> Create(RegistrationDto registerDto)
        {
            var newRegistration = registerDto.ToEntity();

            _context.Registrations.Add(newRegistration);

            await _context.SaveChangesAsync();

            return(true);
        }
示例#18
0
 public async Task<IActionResult> Create([Bind("Id,Name")] Symptoms symptoms)
 {
     if (ModelState.IsValid)
     {
         _context.Add(symptoms);
         await _context.SaveChangesAsync();
         return RedirectToAction(nameof(Index));
     }
     return View(symptoms);
 }
 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);
 }
示例#20
0
        public async Task <IActionResult> Create([Bind("Id,DepartmentName,Patients")] Department department)
        {
            if (ModelState.IsValid)
            {
                _context.Add(department);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(department));
        }
        public async Task <IActionResult> Create([Bind("ID,PID,Treatment,Case_history,Note,medication,When_to_take")] BindMedicationPrescription bindMedicationPrescription)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bindMedicationPrescription);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(bindMedicationPrescription));
        }
        public async Task <IActionResult> Create([Bind("Id,Name")] Designation designation)
        {
            if (ModelState.IsValid)
            {
                _context.Add(designation);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(designation));
        }
示例#23
0
        public async Task <IActionResult> Create([Bind("ID,Drug_ID,Name,Description,Qty,Price,State")] Drug drug)
        {
            if (ModelState.IsValid)
            {
                _context.Add(drug);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(drug));
        }
示例#24
0
        public async Task <IActionResult> Create([Bind("Id,userName,password")] DoctorsLoginModel doctorsLoginModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(doctorsLoginModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(doctorsLoginModel));
        }
        public async Task <IActionResult> Create([Bind("EmployeeId,Name")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
示例#26
0
        public async Task <IActionResult> Create([Bind("Id,patientName,NicNo,Email,Wardno,Date_Cin,telephone,Address,avalablity")] PatientDetails patientDetails)
        {
            if (ModelState.IsValid)
            {
                _context.Add(patientDetails);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(patientDetails));
        }
        public async Task <IActionResult> Create([Bind("Coren,Nome")] Enfermeiros enfermeiros)
        {
            if (ModelState.IsValid)
            {
                _context.Add(enfermeiros);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(enfermeiros));
        }
        public async Task <IActionResult> Create([Bind("Id,Name")] MedicineCategory medicineCategory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(medicineCategory);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(medicineCategory));
        }
示例#29
0
        public async Task <IActionResult> Create([Bind("Id,wardNo,empno,dateDutyOn,timeDutyOn")] Ward ward)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ward);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ward));
        }
        public async Task <IActionResult> Create([Bind("Id,Count")] ReportCount reportCount)
        {
            if (ModelState.IsValid)
            {
                _context.Add(reportCount);
                await _context.SaveChangesAsync();

                // return RedirectToAction(nameof(Index));
            }
            return(View(reportCount));
        }