public ActionResult EditDrugDosage(lmsDrugDosage objDrugDosage) { var saveDrugDosageDetails = _objIAdminOperations.SaveDrugDosage(objDrugDosage); //ViewBag.Message = viewMessage; return(RedirectToAction("ViewDrugDosage", new { id = saveDrugDosageDetails, viewMessage = "Drug Dosage Details Saved Successfully" })); }
public int SaveDrugDosage(lmsDrugDosage objSaveData) { var resultId = 0; try { if (objSaveData.DOSAGEID > 0) { _objLabManagementEntities.lmsDrugDosages.Attach(objSaveData); _objLabManagementEntities.Entry(objSaveData).State = EntityState.Modified; _objLabManagementEntities.SaveChanges(); return(objSaveData.DOSAGEID); } _objLabManagementEntities.lmsDrugDosages.Add(objSaveData); _objLabManagementEntities.SaveChanges(); resultId = _objLabManagementEntities.lmsDrugDosages.ToList().LastOrDefault().DOSAGEID; } catch (Exception ex) { _objIAppLogger.LogError(ex); } return(resultId); }