public HttpResponseMessage Delete(int id) { Employee employee = AdventureWorkDB.Employee.FirstOrDefault(x => x.BusinessEntityID == id); employee.CurrentFlag = false; return(ToJson(AdventureWorkDB.SaveChanges())); }
public HttpResponseMessage Post([FromBody] Employee value) { value.BusinessEntityID = AdventureWorkDB.Employee.OrderByDescending(o => o.BusinessEntityID).FirstOrDefault().BusinessEntityID + 1; value.rowguid = Guid.NewGuid(); value.CurrentFlag = true; AdventureWorkDB.Employee.Add(value); return(ToJson(AdventureWorkDB.SaveChanges())); }
public HttpResponseMessage Put(int id, [FromBody] Employee value) { AdventureWorkDB.Entry(value).State = EntityState.Modified; return(ToJson(AdventureWorkDB.SaveChanges())); }