public IHttpActionResult UpdateShipper(ShipperModel existing) { var entity = new Shipper { CompanyName = existing.CompanyName, Phone = existing.Phone }; _repository.UpdateShipper(entity); return Ok<ShipperModel>(existing); }
public IHttpActionResult CreateShipper(ShipperModel newShipper) { var entity = new Shipper { CompanyName = newShipper.CompanyName, Phone = newShipper.Phone }; entity = _repository.CreateShipper(entity); newShipper.ShipperID = entity.ShipperID; String loc = Url.Link("api/shippers/{shipperID}", new { shipperID = entity.ShipperID }); return Created<ShipperModel>(loc, newShipper); }