public async Task <IHttpActionResult> PostShipper(string[] transnos) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var xDelivery = _SVC.LookupDeliveryType().First(); var xPreData = _SVC.LookupTrading(new TradingQueryViewModel() { TransNos = transnos.ToList() }); Shipper shipper = new Shipper() { TradeDate = DateTime.Today, TradeAmount = xPreData.Sum(s => s.TradeAmount), Buyer = xPreData.First().Buyer, Delivery = xDelivery.ID, Fee = decimal.Zero }; try { await _SVC.AddShipper(shipper, xPreData); } catch (DbUpdateException) { if (ShipperExists(shipper.TransNo)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = shipper.TransNo }, shipper)); }
async public Task <ActionResult> Add(Shipper item) { return(Content(await _Service.AddShipper(item, TempData["ReadyShip"] as IEnumerable <Trading>))); }