public Operation DeleteCmnCountry(CmnCountry objCmnCountry) { Operation objOperation = new Operation { Success = true, OperationId = objCmnCountry.Id }; _CmnCountryRepository.Delete(objCmnCountry); try { _UnitOfWork.Commit(); } catch (Exception) { objOperation.Success = false; } return objOperation; }
public Operation SaveCmnCountry(CmnCountry objCmnCountry) { Operation objOperation = new Operation { Success = true }; long Id = _CmnCountryRepository.AddEntity(objCmnCountry); objOperation.OperationId = Id; try { _UnitOfWork.Commit(); } catch (Exception ex) { objOperation.Success = false; } return objOperation; }
public ActionResult SaveCmnCountry(CmnCountry country) { Operation objOperation = new Operation { Success = false }; if (ModelState.IsValid) { int userId = Convert.ToInt32(Session["userId"].ToString()); country.CreatedBy = userId; if (country.Id == 0) { if ((bool)Session["Add"]) { objOperation = _ccService.SaveCmnCountry(country); } else { objOperation.OperationId = -1; } } else { if ((bool)Session["Edit"]) { country.ModifiedBy = userId; objOperation = _ccService.UpdateCmnCountry(country); } else { objOperation.OperationId = -2; } } } return Json(objOperation, JsonRequestBehavior.DenyGet); }