public JsonResult SaveInvoicePosition(SupplierInvoicePositionItem item) { Service.InvoicePosition.Save(item); var view = this.RenderRazorViewToString(item, "~/Views/Admin/SupplierInvoices/SupplierInvoicePositionsGridRow.cshtml"); return(Json(new { view })); }
public void Save(SupplierInvoicePositionItem item) { var errors = item.GetValidationErrors(); errors.ThrowIfHasErrors(); var position = new tblSupplierInvoicePosition(); if (item.Id != 0) { position = Db.Set<tblSupplierInvoicePosition>() .Include(x => x.tblSupplierInvoice) .Single(x => x.Id == item.Id); } else { position = Db.CreateAndAdd<tblSupplierInvoicePosition>(); } position.Note = item.Note; position.Price = item.Price; position.ProductId = item.ProductId; position.Qty = item.Qty; position.SupplierInvoiceId = item.SupplierInvoiceId; Db.SaveChanges(); item.Id = position.Id; }
public void Save(SupplierInvoicePositionItem item) { var errors = item.GetValidationErrors(); errors.ThrowIfHasErrors(); var position = new tblSupplierInvoicePosition(); if (item.Id != 0) { position = Db.Set <tblSupplierInvoicePosition>() .Include(x => x.tblSupplierInvoice) .Single(x => x.Id == item.Id); } else { position = Db.CreateAndAdd <tblSupplierInvoicePosition>(); } position.Note = item.Note; position.Price = item.Price; position.ProductId = item.ProductId; position.Qty = item.Qty; position.SupplierInvoiceId = item.SupplierInvoiceId; Db.SaveChanges(); item.Id = position.Id; }
public JsonResult SaveInvoicePosition(SupplierInvoicePositionItem item) { Service.InvoicePosition.Save(item); var view = this.RenderRazorViewToString(item, "~/Views/Admin/SupplierInvoices/SupplierInvoicePositionsGridRow.cshtml"); return Json(new { view }); }