public async Task <IActionResult> PutPatient([FromRoute] int id, [FromBody] Patient patient) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != patient.PatientId) { return(BadRequest()); } _context.Entry(patient).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PatientExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("PharmacyId,PharmancyName")] Pharmacy pharmacy) { if (ModelState.IsValid) { _context.Add(pharmacy); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(pharmacy)); }
public async Task <IActionResult> Create([Bind("HospitalId,HospitalName,CreatedBy,ModifiedBy,CreatedOn,ModifiedOn")] Hospital hospital) { if (ModelState.IsValid) { _context.Add(hospital); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(hospital)); }
public async Task <IActionResult> Create([Bind("MedicineId,MedicineCode,PharmacyMedicId,MedicineName,DiseaseCured,Quantity")] Medicine medicine) { if (ModelState.IsValid) { _context.Add(medicine); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PharmacyMedicId"] = new SelectList(_context.Pharmacy, "PharmacyId", "PharmancyName", medicine.PharmacyMedicId); return(View(medicine)); }
public async Task <IActionResult> Update(int id, string Diagonosis) { var testimony = new Prescription() { PrescriptionId = id, PrescriptionCollected = true, Diagonosis = Diagonosis }; _context.Prescription.Attach(testimony); _context.Entry(testimony).Property(x => x.PrescriptionCollected).IsModified = true; _context.Entry(testimony).Property(x => x.Diagonosis).IsModified = true; await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }