public void EditReturnItemObj(ReturnItemObj item) { IsEdit = true; var inv = invoiceData.Where(x => x.id_Invoice == item.InvoiceDataId).SingleOrDefault(); if (inv != null) { inv.Quantity += item.QuantityRet; inv.QuantityRet = item.QuantityRet; inv.ReturnReasonId = item.ReturnReasonId; EdititItem = inv; } else { EdititItem = new sp_sel_InvoiceDataForReturnResult() { Group = item.Group, InvoiceDate = item.InvoiceDate, Supplier = item.Supplier, Name = item.Name, Price = item.Price, Quantity = item.QuantityRet, Number = item.LotNumber, Seria = item.LotNumber, id_Invoice = item.InvoiceDataId, QuantityRet = item.QuantityRet, ReturnReasonId = item.ReturnReasonId, Barcode = item.Barcode, Code = item.Code }; invoiceData.Add(EdititItem); } }
public ActionResult Create([Bind(Include = "InvoiceNo" + "," + "InvoiceDate" + "," + "ProjectID" + "," + "ClientID" + "," + "ClientName" + "," + "ClientAddress" + "," + "ClientGSTIN" + "," + "ClientContactNo" + "," + "ClientEMail" + "," + "AdditionalDiscount" + "," + "Remarks" + "," + "PDFUrl" + "," + "CompanyID" + "," + "AddUserID" + "," + "AddDate" + "," + "ArchiveUserID" + "," + "ArchiveDate" )] Invoice Invoice) { if (ModelState.IsValid) { bool bSucess = false; bSucess = InvoiceData.Add(Invoice); if (bSucess == true) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Can Not Insert"); } } // ComboBox ViewData["ProjectID"] = new SelectList(Invoice_ProjectData.List(), "ProjectID", "ProjectName", Invoice.ProjectID); ViewData["ClientID"] = new SelectList(Invoice_ClientData.List(), "ClientID", "ClientName", Invoice.ClientID); ViewData["CompanyID"] = new SelectList(Invoice_CompanyData.List(), "CompanyID", "CompanyName", Invoice.CompanyID); return(View(Invoice)); }