public ActionResult Save(MedicalModel data) { if (data!=null) { if (data.MedicineId == 0) { data.CreatedAt = DateTime.Now; data.CreatedBy = (Guid)(Session["AdminSession"]); } else { data.UpdatedAt = DateTime.Now; data.UpdatedBy = (Guid)(Session["AdminSession"]); } var medicineService = new MedicineService(); var medicineData = ConvertModelToCore(data); GeneralDatabaseResponse databaseResponse = medicineService.Save(medicineData); return new JsonResult {Data = databaseResponse}; } return new JsonResult {Data = GeneralDatabaseResponse.UnsuccessfullTransaction}; }
public ActionResult GetMedicineDetailsById(int id) { var medicineService = new MedicineService(); var medicalModel = ConvertCoreToModel(medicineService.GetAllMedicines().Where(medicine => medicine.MedicineId == id).ToList()); return new JsonResult { Data = medicalModel }; }
public ActionResult Medical() { MedicineService medicineService = new MedicineService(); List<MedicalModel> medicalModels = ConvertCoreToModel(medicineService.GetAllMedicines()); return View(medicalModels); }
public ActionResult Delete(int id) { MedicineService medicineService = new MedicineService(); GeneralDatabaseResponse databaseResponse = medicineService.DeleteMedicine(id); return new JsonResult { Data = GeneralDatabaseResponse.SuccessfullDelete }; }