public AvailabilityGetDto CreateAvailability(AvailabilityCreateDto availabilityCreateDto) { var availability = new Availability { //Start = availabilityCreateDto.Start, //End = availabilityCreateDto.End, MondayAM = availabilityCreateDto.MondayAM, MondayPM = availabilityCreateDto.MondayPM, TuesdayAM = availabilityCreateDto.TuesdayAM, TuesdayPM = availabilityCreateDto.TuesdayPM, WednesdayAM = availabilityCreateDto.WednesdayAM, WednesdayPM = availabilityCreateDto.WednesdayPM, ThursdayAM = availabilityCreateDto.ThursdayAM, ThursdayPM = availabilityCreateDto.ThursdayPM, FridayAM = availabilityCreateDto.FridayAM, FridayPM = availabilityCreateDto.FridayPM, SaturdayAM = availabilityCreateDto.SaturdayAM, SaturdayPM = availabilityCreateDto.SaturdayPM, SundayAM = availabilityCreateDto.SundayAM, SundayPM = availabilityCreateDto.SundayPM }; //INheriting from EF dbcontext to access // _context.Availabilities.Add(availability); _context.SaveChanges(); var availabilityGetDto = new AvailabilityGetDto { Id = availability.Id, //Start = availability.Start, //End = availability.End MondayAM = availability.MondayAM, MondayPM = availability.MondayPM, TuesdayAM = availability.TuesdayAM, TuesdayPM = availability.TuesdayPM, WednesdayAM = availability.WednesdayAM, WednesdayPM = availability.WednesdayPM, ThursdayAM = availability.ThursdayAM, ThursdayPM = availability.ThursdayPM, FridayAM = availability.FridayAM, FridayPM = availability.FridayPM, SaturdayAM = availability.SaturdayAM, SaturdayPM = availability.SaturdayPM, SundayAM = availability.SundayAM, SundayPM = availability.SundayPM }; return(availabilityGetDto); }
public IActionResult Post([FromBody] AvailabilityCreateDto availabilityCreateDto) { var availability = _availabilityRepository.CreateAvailability(availabilityCreateDto); return(Created("[controller]", availability)); }