public async Task <IActionResult> AddOffert(OffertResource offertResource)
        {
            var offert = OffertMapper.MapOffertResourceToOffert(offertResource);

            _offertRespository.AddOffert(offert);
            await _unitOfWork.UpdateDatabase();

            return(Ok());
        }
示例#2
0
        public static Offert MapOffertResourceToOffert(OffertResource offertResource)
        {
            var offert = new Offert
            {
                Name              = offertResource.Name,
                Description       = offertResource.Description,
                MaxPrice          = offertResource.MaxPrice,
                MinPrice          = offertResource.MinPrice,
                DateEnd           = offertResource.DateEnd,
                DateStart         = offertResource.DateStart,
                IsPublished       = offertResource.IsPublished,
                ActualPlaces      = offertResource.ActualPlaces,
                Places            = offertResource.MaxPlaces,
                OffertType        = offertResource.OffertType,
                AccomodationId    = offertResource.AccomodationId,
                CityId            = offertResource.CityId,
                OffertAttractions = MapAttractionDatesResourcesToOffertAttractions(offertResource.AttractionsDates)
            };

            return(offert);
        }
示例#3
0
        public static OffertResource MapOffertToOffertResource(Offert offert)
        {
            var offertResource = new OffertResource
            {
                Id               = offert.Id,
                Name             = offert.Name,
                Description      = offert.Description,
                MaxPrice         = offert.MaxPrice,
                MinPrice         = offert.MinPrice,
                DateEnd          = offert.DateEnd,
                DateStart        = offert.DateStart,
                MaxPlaces        = offert.Places,
                OffertType       = offert.OffertType,
                IsPublished      = offert.IsPublished,
                ActualPlaces     = offert.ActualPlaces,
                AccomodationId   = offert.AccomodationId,
                CityId           = offert.CityId,
                AttractionsDates = MapOffertAttractionsToAttractionDatesResources(offert.OffertAttractions)
            };

            return(offertResource);
        }