Beispiel #1
0
        public Task <UpdateGroupResponseDto> UpdateGroupSync(UpdateGroupRequestDto dto)
        {
            return(Task.Run(() =>
            {
                UpdateGroupResponseDto resp = new UpdateGroupResponseDto();
                var groupEntity = _groupInfoRepository.Table.SingleOrDefault(t => t.Id.Equals(dto.group_id));
                if (groupEntity != null)
                {
                    groupEntity.CoverUrl = dto.cover_url;
                    groupEntity.Description = dto.description;
                    groupEntity.GMTModified = DateTime.Now;
                    groupEntity.IsHot = dto.is_hot;
                    groupEntity.Name = dto.name;
                    _groupInfoRepository.Update(groupEntity);
                }
                else
                {
                    throw new NotFoundException("不存在待更新的小组");
                }

                return resp;
            }));
        }
        public async Task <IHttpActionResult> Put([FromBody] UpdateGroupRequestDto dto)
        {
            var resp = await _groupService.UpdateGroupSync(dto);

            return(Ok(resp));
        }