public RestApiResult GetInputOrderByID(long id) { InputOrder inputOrder = ClarityDB.Instance.InputOrders.FirstOrDefault(x => x.ID == id); if (inputOrder == null) { return(new RestApiResult { StatusCode = HttpStatusCode.NotFound }); } return(new RestApiResult { StatusCode = HttpStatusCode.OK, Json = inputOrder.ToJson() }); }
public RestApiResult Delete(long id) { InputOrder inputOrder = ClarityDB.Instance.InputOrders.FirstOrDefault(x => x.ID == id); if (inputOrder == null) { return(new RestApiResult { StatusCode = HttpStatusCode.NotFound }); } //Decrease quantity in Inventory when delete InputOrder updateInventoryAfterDeleteInputOrder(id); ClarityDB.Instance.InputOrders.Remove(inputOrder); ClarityDB.Instance.SaveChanges(); return(new RestApiResult { StatusCode = HttpStatusCode.OK, Json = inputOrder.ToJson() }); }