public ActionResult AddressTypes_Create([DataSourceRequest]DataSourceRequest request, AddressType addressType) { if (ModelState.IsValid) { var entity = new AddressType { Name = addressType.Name, rowguid = addressType.rowguid, ModifiedDate = addressType.ModifiedDate }; db.AddressTypes.Add(entity); db.SaveChanges(); addressType.AddressTypeID = entity.AddressTypeID; } return Json(new[] { addressType }.ToDataSourceResult(request, ModelState)); }
public ActionResult AddressTypes_Update([DataSourceRequest]DataSourceRequest request, AddressType addressType) { if (ModelState.IsValid) { var entity = new AddressType { AddressTypeID = addressType.AddressTypeID, Name = addressType.Name, rowguid = addressType.rowguid, ModifiedDate = addressType.ModifiedDate }; db.AddressTypes.Attach(entity); db.Entry(entity).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return Json(new[] { addressType }.ToDataSourceResult(request, ModelState)); }