コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,LogoUrl,IsActive,PaymendType")] Paymend paymend)
        {
            if (id != paymend.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(paymend);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PaymendExists(paymend.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(paymend));
        }
コード例 #2
0
        private async Task <string> GetThankyou(Paymend paymend)
        {
            string thankyou = string.Empty;

            OrderCompletionText message;

            try
            {
                switch (paymend.PaymendType)
                {
                case Enums.PaymendTypeEnum.None:
                    break;

                case Enums.PaymendTypeEnum.Prepay:
                    message = await _context.OrderCompletionTexts.FirstAsync(c => c.PaymendType == Enums.PaymendTypeEnum.Prepay);

                    thankyou = message.Content;
                    break;

                case Enums.PaymendTypeEnum.PayPal:
                    message = await _context.OrderCompletionTexts.FirstAsync(c => c.PaymendType == Enums.PaymendTypeEnum.PayPal);

                    thankyou = message.Content;
                    break;

                case Enums.PaymendTypeEnum.Bill:
                    message = await _context.OrderCompletionTexts.FirstAsync(c => c.PaymendType == Enums.PaymendTypeEnum.Bill);

                    thankyou = message.Content;
                    break;

                default:
                    break;
                }
            }
            catch (Exception e)
            {
                logger.LogError(e, "OrdersController.GetThankyou -> Fehler bei abruf der Auftragsbest&auml;tigung");
            }

            if (string.IsNullOrWhiteSpace(thankyou))
            {
                thankyou = "Danke f&uuml;r deinen Einkauf bei marelibuDesign";
            }

            return(thankyou);
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("ID,Name,LogoUrl,IsActive,PaymendType")] Paymend paymend)
        {
            if (ModelState.IsValid)
            {
                var files = HttpContext.Request.Form.Files;
                foreach (var item in files)
                {
                    var names = await new UploadHelper(_environment).FileUploadAsync(item, "images/paymend", false);
                    paymend.LogoUrl = names.Filename;
                }
                _context.Add(paymend);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(paymend));
        }