예제 #1
0
        public void AddAccomodation(AccomodationDto accomodationDto)
        {
            Accomodation accomodation = new Accomodation(accomodationDto.AccomodationName, accomodationDto.Type, accomodationDto.Description, accomodationDto.OfferedCatering, accomodationDto.PrePayment, accomodationDto.CancellationFee, accomodationDto.AccomodationOwnerId);

            //accomodation.AccomodationOwner = _reservationSiteContext.AccomodationOwners.Find(accomodationDto.AccomodationOwnerId); //nem dob rá null exceptiont, de valamiért nullként adja hozzá ://
            //_reservationSiteContext.AccomodationOwners.Find(accomodationDto.AccomodationOwnerId).Accomodations.Add(accomodation); valamiért null exceptiont ad, még rá kell jönni, hogy miért és hogyan adható hozzá.
            _reservationSiteContext.Accomodations.Add(accomodation);
            _reservationSiteContext.SaveChanges();
        }
예제 #2
0
 public /*async Task<int>*/ void Post([FromBody] AccomodationDto accomodationDto)
 {
     /*await*/ _accomodationService.AddAccomodation(accomodationDto);
     //return StatusCodes.Status200OK;
 }