public async Task <IActionResult> Create([Bind("Id,Name,Charge")] ShippingMethod shippingMethod)
        {
            if (ModelState.IsValid)
            {
                _context.Add(shippingMethod);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(shippingMethod));
        }
        public async Task <IActionResult> Create([Bind("Id,ItemName,ItemPrice")] Gift gift)
        {
            if (ModelState.IsValid)
            {
                _context.Add(gift);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(gift));
        }
        public async Task <IActionResult> Create([Bind("Id,SenderName,MobileNumber")] GiftSender giftSender)
        {
            if (ModelState.IsValid)
            {
                _context.Add(giftSender);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(giftSender));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("Id,GiftSenderId,GiftId,ShippingMethodId,Reciever,RecieverAddress")] GiftPurchase giftPurchase)
        {
            if (ModelState.IsValid)
            {
                _context.Add(giftPurchase);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GiftId"]           = new SelectList(_context.Gift, "Id", "Id", giftPurchase.GiftId);
            ViewData["GiftSenderId"]     = new SelectList(_context.Set <GiftSender>(), "Id", "Id", giftPurchase.GiftSenderId);
            ViewData["ShippingMethodId"] = new SelectList(_context.Set <ShippingMethod>(), "Id", "Id", giftPurchase.ShippingMethodId);
            return(View(giftPurchase));
        }