Exemplo n.º 1
0
 public async Task CompleteDeal(CompletedDeal competedDeal)
 {
     if (competedDeal != null)
     {
         await _dbContext.CompletedDeal.AddAsync(competedDeal);
     }
 }
Exemplo n.º 2
0
        public async Task <IActionResult> ClientCompleteDeal(Guid dealId, string timingScore, string communicationScore, string deliciousScore, string adviceScore, string comment)
        {
            var deal = await _dbContext.Deal.Where(x => x.Id == dealId).Include(y => y.OrderOffer).FirstOrDefaultAsync();

            if (deal.IsChiefConfirm == true && deal.IsClientConfirm == false)
            {
                deal.IsClientConfirm = true;
                deal.IsDone          = true;
                _dbContext.SaveChanges();
            }

            if (deal.IsDone == true)
            {
                var completedDeal = new CompletedDeal()
                {
                    Id                 = Guid.NewGuid(),
                    Deal               = deal,
                    DeliciousScore     = Convert.ToDouble(deliciousScore),
                    TimingScore        = Convert.ToDouble(timingScore),
                    CommunicationScore = Convert.ToDouble(communicationScore),
                    AdviceScore        = Convert.ToDouble(adviceScore),
                    Comment            = comment,
                    CreatedAt          = DateTime.Now
                };

                await _dealService.CompleteDeal(completedDeal);

                _dbContext.SaveChanges();

                var client = await _userManager.GetUserAsync(User);

                var chief = await _dbContext.Users.Where(x => x.Id == deal.ChiefId).FirstOrDefaultAsync();

                await _notificationService.SendNotification(new Notification()
                {
                    Id                 = Guid.NewGuid(),
                    SenderId           = client.Id,
                    SenderName         = "" + client.Name + " " + client.Surname,
                    ReceiverId         = chief.Id,
                    IsItRead           = false,
                    CreatedAt          = DateTime.Now,
                    ReturnUrl          = "/Deal/ChiefCompletedDealsList",
                    NotificationString = "sipariş teslimatını onayladı, ellerinize sağlık!"
                });
            }

            return(Redirect("/anasayfa"));
        }
Exemplo n.º 3
0
 public async Task CompleteDeal(CompletedDeal competedDeal)
 {
     await _uow.Deals.CompleteDeal(competedDeal);
 }