public int Save(lmsObstericAdmissionSheet data) { var resultId = 0; try { if (data.OASID > 0) { _objLabManagementEntities.lmsObstericAdmissionSheets.Attach(data); _objLabManagementEntities.Entry(data).State = EntityState.Modified; _objLabManagementEntities.SaveChanges(); return(data.OASID); } _objLabManagementEntities.lmsObstericAdmissionSheets.Add(data); _objLabManagementEntities.SaveChanges(); var result = _objLabManagementEntities.lmsObstericAdmissionSheets.ToList().LastOrDefault(); resultId = result.OASID; } catch (Exception ex) { _objIAppLogger.LogError(ex); } return(resultId); }
public ActionResult EditObstetricAdmissionSheet(lmsObstericAdmissionSheet data) { if (!data.CREATEDDATE.HasValue) { data.CREATEDDATE = DateTime.Now; } var saveData = obstericAdmissionSheetReports.Save(data); //ViewBag.Message = viewMessage; return(RedirectToAction("ViewObstetricAdmissionSheet", new { id = saveData, viewMessage = "Obstetric Admission Sheet Saved Successfully" })); }