public int UpdateStatii(Statii category) { var entry = this.dbcontext.Entry(category); entry.State = EntityState.Modified; return(this.dbcontext.SaveChanges()); }
public void ListView1_InsertItem() { var item = new Statii(); TryUpdateModel(item); if (ModelState.IsValid) { this.StatiiiServices.InsertStatiq(item); } }
// The id parameter name should match the DataKeyNames value set on the control public void ListView1_UpdateItem(int id) { Statii item = null; // Load the item here, e.g. item = MyDataLayer.Find(id); item = this.StatiiiServices.GetById(id); if (item == null) { // The item wasn't found ModelState.AddModelError("", String.Format("Item with id {0} was not found", id)); return; } TryUpdateModel(item); if (ModelState.IsValid) { this.StatiiiServices.UpdateStatii(item); } }
public int InsertStatiq(Statii statiq) { this.dbcontext.statii.Add(statiq); return(this.dbcontext.SaveChanges()); }