public Task <UpdateCategoryOffLineStatusResponse> UpdateOffLineStatusAsync(UpdateCategoryOffLineStatus dto) { return(Task.Run(() => { var categoryEntity = _categoryEntityRepository.Table.Where(t => t.Id.Equals(dto.id)).SingleOrDefault(); if (categoryEntity == null) { throw new RequestErrorException("分类不存在"); } categoryEntity.OffLine = dto.off_line; _categoryEntityRepository.Update(categoryEntity); return new UpdateCategoryOffLineStatusResponse(); })); }
public async Task <IHttpActionResult> Patch([FromBody] UpdateCategoryOffLineStatus dto) { var resp = await _categoryService.UpdateOffLineStatusAsync(dto); return(Ok(resp)); }