Exemplo n.º 1
0
        public IActionResult Create([FromBody] TimeslotDto timeslotDto)
        {
            timeslotDto.Id = Guid.NewGuid();

            var timeslotEntity = _mapper.Map <Timeslot>(timeslotDto);

            _timeslotService.Create(timeslotEntity, timeslotDto.EventId);

            return(Ok(timeslotDto));
        }
Exemplo n.º 2
0
        public IActionResult Update([FromBody] TimeslotDto timeslotDto)
        {
            if (timeslotDto == null || timeslotDto.Id == Guid.Empty)
            {
                return(BadRequest("Timeslot not found."));
            }
            var timeslotEntity = _mapper.Map <Timeslot>(timeslotDto);

            _timeslotService.Update(timeslotEntity);

            return(Ok(timeslotDto));
        }