Пример #1
0
        public async Task <SeasonModel> Put(int id, [FromBody] UpdateSeasonModel requestModel)
        {
            var item = await _query.Update(id, requestModel);

            var model = _mapper.Map <SeasonModel>(item);

            return(model);
        }
        public async Task <Season> Update(int id, UpdateSeasonModel model)
        {
            var season = GetQuery().FirstOrDefault(x => x.Id == id);

            if (season == null)
            {
                throw new NotFoundException("Season is not found");
            }

            season.Description = model.Description;
            season.StartDate   = model.StartDate;
            season.EndDate     = model.EndDate;

            await _uow.CommitAsync();

            return(season);
        }