public async Task <bool> SendApplication(AplicationDto ApDto)
        {
            UserApplication newAplication = new UserApplication()
            {
                DriverLicencePhoto = ApDto.DriverLicencePhoto,
                UserId             = ApDto.UserId,
                Date            = ApDto.Date,
                DriverLicenceNo = ApDto.DriverLicenceNo,
                CarId           = ApDto.CarId,
            };

            await _dbContext.UserApplications.AddAsync(newAplication);

            return(await _dbContext.SaveChangesAsync() > 0);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> SendApplication([FromBody] AplicationDto ApDto)
        {
            try
            {
                var result = await _AplicationRepository.SendApplication(ApDto);

                if (result)
                {
                    return(Ok("success"));
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message + " " + ex.InnerException));
            }
        }