I have error for Distinctbylast(p => p.ID)) isn't in library .
// POST: InvPurchaseD/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
public ActionResult Update([FromBody] List<tblivInvInD> ivInvInDed)
{
try
{
ivInvInDVM tbl = new ivInvInDVM();
// only get unique values to avoid duplication of data from grid array
foreach (tblivInvInD element in ivInvInDed.Distinctbylast(p => p.ID))
{
if (element.ID < 0)
element.ID = 0;
tbl.ivInvInD = element; tbl.LogonUser = User.Identity.Name;
int Result = tbl.Update();
if (Result == -1)
throw new System.ArgumentException(tbl.GlobalError, "DBlevel");
}
logger.LogInformation("ivInvInD ID {0} is Edited Scussefully ", ivInvInDed.Count);
return Json(new { success = true });
}
catch (Exception dex)
{
logger.LogError("Unable to save changes. in ivInvInD with Message " + dex.Message);
ModelState.AddModelError("", "Unable to save changes. " + dex.Message);
AddPageAlerts(PageAlertType.Error, $"unable to save chnages with error {Global.Models.SiteUtils.FriendlyErrorMessage(dex)}");
return Json(new { success = false, responseText = Global.Models.SiteUtils.FriendlyErrorMessage(dex) });
}
// //return Json(new { success = true, responseText = "end of Page" });
}
