public ActionResult Create(string xBuyer)
 {
     return(PartialView(_Service.LookupTrading(new TradingQueryViewModel()
     {
         Buyer = xBuyer, IsShipped = false
     }).ToList()));
 }
 // GET: api/ApiTradings
 public List <TradingDTOs> GetTrading(DateTime?StartDate, DateTime?EndDate, string Buyer, string CommodityID)
 {
     return(MapperConfig.mapper.Map <List <TradingDTOs> >(_SVC.LookupTrading(new TradingQueryViewModel()
     {
         TradeDate_S = StartDate,
         TradeDate_E = EndDate,
         Buyer = Buyer,
         CommodityID = CommodityID
     })));
 }
        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));
        }
 public ActionResult Grid(TradingQueryViewModel filter)
 {
     return(PartialView(_Service.LookupTrading(filter).ToList()));
 }