public ActionResult EditState(lmsStateMaster objStateMaster) { var saveStateDetails = _objIAdminOperations.SaveState(objStateMaster); //ViewBag.Message = viewMessage; return(RedirectToAction("ViewState", new { StateId = saveStateDetails, viewMessage = "State Details Saved Successfully" })); }
public int SaveState(lmsStateMaster objStateMaster) { var resultId = 0; try { if (objStateMaster.STATEID > 0) { _objLabManagementEntities.lmsStateMasters.Attach(objStateMaster); _objLabManagementEntities.Entry(objStateMaster).State = EntityState.Modified; _objLabManagementEntities.SaveChanges(); return(objStateMaster.STATEID); } _objLabManagementEntities.lmsStateMasters.Add(objStateMaster); _objLabManagementEntities.SaveChanges(); resultId = _objLabManagementEntities.lmsStateMasters.LastOrDefault().STATEID; } catch (Exception ex) { _objIAppLogger.LogError(ex); } return(resultId); }