Esempio n. 1
0
        public async Task <IActionResult> TakeIt(int Id)
        {
            var isFree = await adsServices.CheckIfAdIsFree(Id);

            if (isFree)
            {
                var driverUserId = HttpContext.User.Claims.FirstOrDefault().Value;
                var driverIdInt  = driverSer.GetDriverId(driverUserId);
                var ad           = await adsServices.GetUserAdAsync(Id);

                await adsServices.AddDriverToAd(Id, driverIdInt);
            }
            return(RedirectToAction(nameof(Index)));
        }