public Acquire GetAcquirerById(int acquireId) { var acquirer = new Acquire(); try { acquirerRepo.DbContext.BeginTransaction(); acquirer = acquirerRepo.GetAll().Single(u => u.Id == acquireId); acquirerRepo.DbContext.CommitTransaction(); return acquirer; } catch (Exception ex) { LogManager.LogException(ex); return new Acquire(); } }
public bool Delete(int acquirerId) { var acquirer = new Acquire(); try { acquirerRepo.DbContext.BeginTransaction(); acquirer = acquirerRepo.GetAll().Single(u => u.Id == acquirerId); acquirerRepo.Delete(acquirer); acquirerRepo.DbContext.CommitTransaction(); return true; } catch (Exception ex) { LogManager.LogException(ex); return false; } }
/// <summary> /// Laoding Acquire user list /// </summary> public ActionResult Acquirer() { var acquiremodel = new Acquire { Enabled = false, LogicalId = 0, name = string.Empty }; if (HttpContext.Cache["acquireModel"] != null) { var cachedAcquireModel = (Acquire)HttpContext.Cache["acquireModel"]; acquiremodel.name = cachedAcquireModel.name; acquiremodel.LogicalId = cachedAcquireModel.LogicalId; acquiremodel.TotalRecordsCount = cachedAcquireModel.Acquires.Count; acquiremodel.Acquires = cachedAcquireModel.Acquires.Take(Setting.Page_Size).ToList<Acquire>(); } else { acquiremodel.Acquires = acquireTask.GetAllAquires().ToList(); acquiremodel.TotalRecordsCount = acquiremodel.Acquires.Count; HttpContext.Cache["acquireModel"] = new Acquire() { Acquires = acquiremodel.Acquires.ToList() }; acquiremodel.Acquires = acquiremodel.Acquires.Take(Setting.Page_Size).ToList(); } return View(acquiremodel); }
public bool UpdateAcquirer(Acquire acquire) { try { acquirerRepo.DbContext.BeginTransaction(); acquirerRepo.SaveOrUpdate(acquire); acquirerRepo.DbContext.CommitTransaction(); return true; } catch (Exception ex) { LogManager.LogException(ex); return false; } }
public ActionResult SaveAcquire() { var acquires = new List<Acquire>(); var count = 0; var name = Request.Form.GetValues(CommonResources.Acquire_name.ToLower())[0]; var LogicalId = Convert.ToInt32(Request.Form.GetValues(CommonResources.Acquire_LogicalId.ToLower())[0]); var Enabled = Convert.ToBoolean(Request.Form.GetValues(CommonResources.Acquire_Enabled.ToLower())[0]); var _acquire = new Acquire(); _acquire.name = name; _acquire.Enabled = Enabled; _acquire.LogicalId = LogicalId; acquireTask.UpdateAcquirer(_acquire); acquires = acquireTask.GetAllAquires(); HttpContext.Cache["acquireModel"] = new Acquire() { name = name, LogicalId = LogicalId, Acquires = acquires }; count = acquires.Count; return RedirectToAction("Acquirer"); }