public ActionResult Create([Bind(Include = "ToDoID,Description,Closed,ApplicationUserID,IsReady")] ToDo toDo) { if (ModelState.IsValid) { db.ToDoes.Add(toDo); db.SaveChanges(); string actionName = this.ControllerContext.RouteData.Values["action"].ToString(); string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); LogJobs.LogSuccess(toDo.ToDoID.ToString(), controllerName, actionName); return(RedirectToAction("Index")); } ViewBag.UserID = new SelectList(db.Users, "Id", "Nick", toDo.ApplicationUser); return(View(toDo)); }
public ActionResult Create([Bind(Include = "SaleTonerID,SaleTonerDate,TonerPrice,OwnerID,TonerID,TonerQuantity,InvoiceNo")] SaleToner saleToner) { ApplicationDbContext db = new ApplicationDbContext(); if (ModelState.IsValid) { db.SaleToners.Add(saleToner); db.SaveChanges(); string actionName = this.ControllerContext.RouteData.Values["action"].ToString(); string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); LogJobs.LogSuccess(saleToner.SaleTonerID.ToString(), controllerName, actionName); return(RedirectToAction("Index")); } ViewBag.OwnerID = new SelectList(db.Owners, "OwnerID", "OwnerName", saleToner.OwnerID); ViewBag.TonerID = new SelectList(db.Toners, "TonerID", "TonerModel", saleToner.TonerID); return(View(saleToner)); }