Exemplo n.º 1
0
        public async Task <IActionResult> CommditiesOrderCreate(CommoditiesOrderViewModel commoditiesorder)
        {
            var commodities       = _context.Commoditys.Single(x => x.Id == commoditiesorder.commoditiesid);
            var commoditiesorders = new CommodityOrder {
                Commoditys = commodities, Name = commoditiesorder.Name, Number = commoditiesorder.Number, Remarks = commoditiesorder.Remarks, SaleStates = commoditiesorder.SaleStates, CommoditysId = commodities.Id, OrderStatus = true
            };

            _context.CommodityOrders.Add(commoditiesorders);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Exemplo n.º 2
0
        // GET: Commodities/Details/5
        public async Task <IActionResult> Details(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var commodities = await _context.Commoditys
                              .FirstOrDefaultAsync(m => m.Id == id);

            CommoditiesOrderViewModel fo = new CommoditiesOrderViewModel {
                commoditiesid = commodities.Id, picture = commodities.picture, Price = commodities.Price, Name = commodities.Name, Number = "1", Remarks = ""
            };

            return(View(fo));
        }