// // GET: /Project/Accounting/ public ActionResult Index(AccountingRequest request) { var model = new Accounting(); this.RenderMyViewData(model); //ViewData.Add("Rank", new SelectList(EnumHelper.GetItemValueList<EnumRank>(), "Key", "Value", model.Rank)); //ViewData.Add("AccountDep", new SelectList(EnumHelper.GetItemValueList<EnumDep>(), "Key", "Value", model.AccountDep)); var result = this.ProjectService.GetAccountingList(request); return View(result); }
public ActionResult Create(FormCollection collection) { try { var model = new Accounting(); this.TryUpdateModel<Accounting>(model); this.ProjectService.SaveAccounting(model); return this.RefreshParent(); } catch { return View(); } }
public void SaveAccounting(Accounting accounting) { using (var dbContext = new ProjectDbContext()) { if (accounting.ID > 0) { dbContext.Update<Accounting>(accounting); } else { dbContext.Insert<Accounting>(accounting); } } }
// // GET: /Project/Accounting/Create public ActionResult Create() { var model = new Accounting(); this.RenderMyViewData(model); return View("Edit",model); }
private void RenderMyViewData(Accounting model) { ViewData.Add("Rank", new SelectList(EnumHelper.GetItemValueList<EnumRank>(), "Key", "Value", model.Rank)); ViewData.Add("AccountDep", new SelectList(EnumHelper.GetItemValueList<EnumDep>(), "Key", "Value", model.AccountDep)); }