public ActionResult Edit(InvoiceVm model) { try { if (!ModelState.IsValid) { return(View(model)); } var Invoice = _mapper.Map <Invoice>(model); var isvalid = _repo.Update(Invoice); if (!isvalid) { ModelState.AddModelError("", "Could not edit Invoices. Try Again"); return(View(model)); } return(RedirectToAction(nameof(Index))); } catch { ModelState.AddModelError("", "Could not edit Invoices. Try Again"); return(View()); } }
//更新单个(查ID) public static int Update(M_Invoice Obj, ref string ErrMsg) { I_Invoice I = (D_Invoice)SimpleFactory.CreateObject(DBType.Invoice); return I.Update(Obj, ref ErrMsg); }