public ActionResult ProductModelIllustrations_Destroy([DataSourceRequest]DataSourceRequest request, ProductModelIllustration productModelIllustration) { if (ModelState.IsValid) { var entity = new ProductModelIllustration { ProductModelID = productModelIllustration.ProductModelID, IllustrationID = productModelIllustration.IllustrationID, ModifiedDate = productModelIllustration.ModifiedDate }; db.ProductModelIllustrations.Attach(entity); db.ProductModelIllustrations.Remove(entity); db.SaveChanges(); } return Json(new[] { productModelIllustration }.ToDataSourceResult(request, ModelState)); }
public ActionResult ProductModelIllustrations_Create([DataSourceRequest]DataSourceRequest request, ProductModelIllustration productModelIllustration) { if (ModelState.IsValid) { var entity = new ProductModelIllustration { ProductModelID = productModelIllustration.ProductModelID, IllustrationID = productModelIllustration.IllustrationID, ModifiedDate = DateTime.Now }; db.ProductModelIllustrations.Add(entity); db.SaveChanges(); productModelIllustration.ProductModelID = entity.ProductModelID; } return Json(new[] { productModelIllustration }.ToDataSourceResult(request, ModelState)); }