示例#1
0
        public async Task <IActionResult> Create([Bind("Name,DueTime,BusinessPartnerId,Id")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                var orders = await _context.GetAllOrders.ToListAsync();

                ViewData["OrderId"] = order.Id;
                return(View("Index", orders));
            }
            ViewData["BusinessPartnerId"] = new SelectList(_context.BusinessPartners, "Id", "Name", order.BusinessPartnerId);
            return(PartialView("Create", order));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("Name,DueTime,BusinessPartnerId,Id")] T_CustomerOrder order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(entity: order);
                await _context.SaveChangesAsync();

                var orders = await _context.GetAllOrders.ToListAsync();

                ViewData[index : "OrderId"] = order.Id;
                return(View(viewName: "Index", model: orders));
            }
            ViewData[index : "BusinessPartnerId"] = new SelectList(items : _context.BusinessPartners, dataValueField : "Id", dataTextField : "Name", selectedValue : order.BusinessPartnerId);
            return(PartialView(viewName: "Create", model: order));
        }
        public async Task <IActionResult> Create([Bind("OrderId,ArticleId,Quantity,IsPlanned,Id")] T_CustomerOrderPart orderPart)
        {
            if (ModelState.IsValid)
            {
                _context.Add(entity: orderPart);
                await _context.SaveChangesAsync();

                var orders = await _context.GetAllOrders.ToListAsync();

                ViewData[index : "OrderId"] = orderPart.CustomerOrderId;
                return(View(viewName: "../Orders/Index", model: orders));
            }
            ViewData[index : "ArticleId"] = new SelectList(items : _context.GetSellableArticles, dataValueField : "Id", dataTextField : "Name", selectedValue : orderPart.ArticleId);
            ViewData[index : "OrderId"]   = new SelectList(items : _context.CustomerOrders, dataValueField : "Id", dataTextField : "Name", selectedValue : orderPart.CustomerOrderId);
            return(PartialView(viewName: "Create", model: orderPart));
        }
        public async Task <IActionResult> Create([Bind("OrderId,ArticleId,Quantity,IsPlanned,Id")] OrderPart orderPart)
        {
            if (ModelState.IsValid)
            {
                _context.Add(orderPart);
                await _context.SaveChangesAsync();

                var orders = await _context.GetAllOrders.ToListAsync();

                ViewData["OrderId"] = orderPart.OrderId;
                return(View("../Orders/Index", orders));
            }
            ViewData["ArticleId"] = new SelectList(_context.GetSellableArticles, "Id", "Name", orderPart.ArticleId);
            ViewData["OrderId"]   = new SelectList(_context.Orders, "Id", "Name", orderPart.OrderId);
            return(PartialView("Create", orderPart));
        }