public PurchasedOrder UpdatePurchasedOrder(PurchasedOrder purchasedOrder) { try { _purchasedOderRepository.Update(purchasedOrder); _purchasedOderRepository.Save(); return _purchasedOderRepository.GetDatabaseValues(purchasedOrder); } catch (Exception) { return null; } }
public bool AddPurchasedOrder(PurchasedOrder purchasedOrder) { try { _purchasedOderRepository.Add(purchasedOrder); _purchasedOderRepository.Save(); return true; } catch (Exception) { return false; } }
public IHttpActionResult PutPurchasedOrder(int id, PurchasedOrder purchasedOrder) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != purchasedOrder.ID) { return BadRequest(); } try { var result = _purchasedOrderService.UpdatePurchasedOrder(purchasedOrder); } catch (Exception) { return NotFound(); } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostPurchasedOrder(PurchasedOrder purchasedorder) { if (!ModelState.IsValid) { return BadRequest(ModelState); } var success = _purchasedOrderService.AddPurchasedOrder(purchasedorder); if (!success) { return BadRequest(ModelState); } return CreatedAtRoute("DefaultApi", new { id = purchasedorder.ID }, purchasedorder); }