public bool modifyItem(DataObj dataObj) { if (dataObj == null) return false; ExampleDatas person = context.TodoData.SingleOrDefault(p=> p.Id == dataObj.Id); person.Name = dataObj.Name; person.Description = dataObj.Description; person.Site = dataObj.Site; context.SaveChanges(); return true; }
public bool saveItem(DataObj dataObj) { if (dataObj == null) return false; ExampleDatas person = new ExampleDatas(); person.Name = dataObj.Name; person.Description = dataObj.Description; person.Site = dataObj.Site; context.TodoData.Add(person); context.SaveChanges(); return true; }