Exemplo n.º 1
0
        public async Task <IActionResult> RejectLot(LotModerationModel model)
        {
            if (ModelState.IsValid)
            {
                await crudLotLogic.Update(new AuctionLot
                {
                    Id     = model.AuctionLot.Id,
                    Status = LotStatusProvider.GetRejectedStatus()
                });

                await crudNoteLogic.Delete(new Note
                {
                    AuctionLotId = model.AuctionLot.Id
                });

                await crudNoteLogic.Create(new Note
                {
                    AuctionLotId = model.AuctionLot.Id,
                    Text         = model.RejectNote
                });
                await SendRejectMessage(model.AuctionLot.Id, model.RejectNote);

                return(View("Redirect", new RedirectModel
                {
                    InfoMessages = RedirectionMessageProvider.LotRejectedMessages(),
                    SecondsToRedirect = ApplicationConstantsProvider.GetLongRedirectionTime(),
                    RedirectUrl = "/Moderator/Lots"
                }));
            }
            model.Expanded = true;
            return(View("CheckLot", model));
        }