public ActionResult InboundTask(InboundTaskViewModel model) { if (ModelState.IsValid) { var db = new DbEntities <InboundTask>().SimpleClient; //编号不重复 if (db.IsAny(ib => ib.InboundTaskNo == model.InboundTaskNo)) { ModelState.AddModelError("InboundTaskNo", "该编号已存在"); } else { //登录人信息 if (new IdentityAuth().GetCurUserID(HttpContext, out int curUserID)) { InboundTask entity = model.InitAddInboundTask(curUserID); if (db.Insert(entity)) { TempData["Msg"] = $"入库任务单 [{entity.InboundTaskNo}] 添加成功"; return(RedirectToAction("InboundTask", "Warehouse")); } TempData["Msg"] = "添加失败"; } else { TempData["Msg"] = "登录身份过期,请重新登录"; } } } SetSelectListItems.Supplier(this, model.SupplierID); SetSelectListItems.InboundType(this, model.InboundType); return(View(model)); }
public ActionResult InboundTask() { SetSelectListItems.Supplier(this); SetSelectListItems.InboundType(this); return(View()); }