Exemple #1
0
 public CarAnagraphicReadModel Map(CarAnagraphicModel car)
 {
     if (car == null)
     {
         return(new CarAnagraphicReadModel());
     }
     return(new CarAnagraphicReadModel
     {
         Colour = car.Colour,
         LicencePlate = car.LicencePlate,
         Model = car.Model
     });
 }
Exemple #2
0
        /// <summary>
        /// determine if the authorization of the car match the needed Authorization
        /// </summary>
        /// <param name="CarModelId">car anagraphic</param>
        /// <param name="AuthNeeded">needed Authorization</param>
        /// <returns></returns>
        public async Task <bool> IsCarAutorized(string CarModelId, WellknownAuthorizationLevel AuthNeeded)
        {
            try
            {
                CarAnagraphicModel car = await _context.Cars.FirstOrDefaultAsync(ca => ca.LicencePlate == CarModelId).ConfigureAwait(false);

                return(await IsAutorized(car.Owner.Id, AuthNeeded).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                StaticEventHandler.Log(System.Diagnostics.TraceLevel.Error, "error during IsAutorized of CAR", MethodBase.GetCurrentMethod(), ex);
                return(false);
            }
        }