Пример #1
0
        public async Task <int> Create(NewWorkScheduleDto newScheduleDto)
        {
            var newSchedule = _mapper.Map <WorkSchedule>(newScheduleDto);
            var id          = await _repository.Create(newSchedule);

            return(id);
        }
Пример #2
0
        public async Task <bool> Update(int id, NewWorkScheduleDto updateData)
        {
            var scheduleToUpdate = await _repository.GetById(id);

            _mapper.Map(updateData, scheduleToUpdate);
            var successful = await _repository.Update(scheduleToUpdate);

            return(successful);
        }
Пример #3
0
        public async Task <IActionResult> Put(int id, [FromBody] NewWorkScheduleDto newWorkSchedule)
        {
            var successful = await _workSchedulesService.Update(id, newWorkSchedule);

            return(Ok(successful));
        }
Пример #4
0
        public async Task <IActionResult> Post(NewWorkScheduleDto newWorkSchedule)
        {
            var id = await _workSchedulesService.Create(newWorkSchedule);

            return(Ok(id));
        }