public Task <UpdateWorksHotStatusResponse> UpdateHotStatusAsync(UpdateWorksHotStatus dto)
        {
            return(Task.Run(() =>
            {
                var worksEntity = _worksRepository.TableNoTracking.Where(t => t.Id.Equals(dto.works_id)).SingleOrDefault();
                if (worksEntity == null)
                {
                    throw new RequestErrorException("该作品不存在!");
                }
                var worksMeta = _worksMetaRepository.Table.Where(t => t.WorksId.Equals(dto.works_id)).SingleOrDefault();

                worksMeta.IsHot = dto.is_hot;
                _worksMetaRepository.Update(worksMeta);
                return new UpdateWorksHotStatusResponse();
            }));
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> Patch([FromBody] UpdateWorksHotStatus dto)
        {
            var resp = await _worksService.UpdateHotStatusAsync(dto);

            return(Ok(resp));
        }