public ActionResult Create(FormCollection collection) { var model = new Accountant(); this.TryUpdateModel<Accountant>(model); this.ProjectService.SaveAccountant(model); return this.RefreshParent(); }
// // GET: /Cms/Article/Create //[HttpPost] //public ActionResult Search(FormCollection collection) //{ // string ClassName = collection["ClassName"]; // string code = collection["Code"]; // this.ViewData["Code"] = code; // this.ViewData["ClassName"] = ClassName; // var result = this.BasisDataService.GetClassificationList(new ClassificationRequest() { Name = ClassName, Code = code }); // return View(result); //} public ActionResult Create() { //var classList = this.BasisDataService.GetClassificationList(new ClassificationRequest() { Name = "wenju" }); //this.ViewBag.ChannelId = new SelectList(classList, "ID", "Name"); var model = new Accountant(); return View("Edit", model); }
public void SaveAccountant(Accountant account) { using (var dbContext = new ProjectDbContext()) { if (account.ID > 0) { dbContext.Update<Accountant>(account); } else { dbContext.Insert<Accountant>(account); } } }