示例#1
0
        public async Task UpdateRider(DTO.Rider rider)
        {
            Models.Rider current = await GetRider(rider.IdRider);

            RiderMapper.MapRiderDTO(current, rider);
            await deliveriesDbContext.SaveChangesAsync();
        }
示例#2
0
 internal static void MapRiderDTO(Models.Rider current, DTO.Rider input)
 {
     current.Active        = input.Active.HasValue ? input.Active.Value : current.Active;
     current.AverageRating = input.AverageRating ?? current.AverageRating;
     current.Range         = input.Range ?? current.Range;
     current.RiderName     = string.IsNullOrEmpty(input.RiderName) ? current.RiderName : input.RiderName;
     current.StartingPoint = GetGeometry(input.StartingPoint) ?? current.StartingPoint;
 }
示例#3
0
        public async Task <int> AddRider(DTO.Rider rider)
        {
            Models.Rider newRider = RiderMapper.MapNewRiderDTO(rider);
            deliveriesDbContext.Rider.Add(newRider);
            await deliveriesDbContext.SaveChangesAsync();

            return(newRider.IdRider);
        }
示例#4
0
 internal static Models.Rider MapNewRiderDTO(DTO.Rider input)
 {
     Models.Rider output = new Models.Rider()
     {
         Active        = true,
         AverageRating = null,
         Range         = input.Range,
         RiderName     = input.RiderName,
         StartingPoint = GetGeometry(input.StartingPoint)
     };
     return(output);
 }