public void Update(UpdateTeamDto team) { Guid Id = new Guid(team.Id); Team teamToUpdate = _repository.GetByFilter <Team>(p => p.Id == Id); if (teamToUpdate == null) { return; } if (team.Name != null) { teamToUpdate.Name = team.Name; } if (team.Description != null) { teamToUpdate.Description = team.Description; } if (team.IdProject != null) { teamToUpdate.IdProject = team.IdProject; } _repository.Update(teamToUpdate); _repository.Save(); }
/// <summary> /// 団体情報を変更します。 /// </summary> /// <param name="teamJpin">JPINの団体番号。</param> public void ChangeTeamData(UpdateTeamDto dto) { this.TeamName = new TeamName(dto.TeamName); this.TeamAbbreviatedName = TeamAbbreviatedName.Parse(dto.TeamAbbreviatedName); this.RepresentativeName = dto.RepresentativeName; this.RepresentativeEmailAddress = dto.RepresentativeEmailAddress; this.TelephoneNumber = dto.TelephoneNumber; this.Address = dto.Address; this.CoachName = dto.CoachName; this.CoachEmailAddress = dto.CoachEmailAddress; }
public async Task <IActionResult> UpdateTeamAsync([FromBody] UpdateTeamDto dto) { string openId = GetOpenId(); try { var data = await _teamServices.UpdateTeamAsync(dto, openId); return(UpdateSuccessMsg()); } catch (Exception err) { _logger.Error(typeof(TeamController), "更新团队信息失败!", new Exception(err.Message)); return(FailedMsg("更新团队信息失败! " + err.Message)); } }
/// <summary> /// 更新团队信息 /// </summary> /// <param name="dto"></param> /// <param name="openId"></param> /// <returns></returns> public async Task <bool> UpdateTeamAsync(UpdateTeamDto dto, string openId) { return(await Task.Run(() => { var UserId = db.Queryable <Wx_UserInfo>().Where(a => a.OpenId == openId).First()?.ID; var result = db.Updateable <Team>().SetColumns(a => new Team() { TeamName = dto.TeamName, TeamInfo = dto.TeamInfo, LastModifyUserId = UserId, LastModifyTime = DateTime.Now }) .Where(a => a.ID == dto.ID) .ExecuteCommand(); return result > 0; })); }
public IHttpActionResult UpdateCustomer(int id, UpdateTeamDto updateTeamDto) { if (!ModelState.IsValid) { return(BadRequest()); } var teamInDb = _context.SelectedTeams.SingleOrDefault(c => c.Id == id); if (teamInDb == null) { return(NotFound()); } Mapper.Map(updateTeamDto, teamInDb); _context.SaveChanges(); return(Ok()); }
public IActionResult Update([FromBody] UpdateTeamDto teamDto) { _teamLogic.Update(teamDto); return(NoContent()); }
public ActionResult <TeamDto> UpdateTeam(Guid personId, Guid projectId, Guid teamId, [FromBody] UpdateTeamDto dto) { try { if (!ModelState.IsValid) { return(BadRequest()); } if (!_db.Person.BelongsToUser(personId, HttpContext)) { return(Forbid()); } if (_db.Participation.GetRole(personId, projectId)?.CalendarWrite != true) { return(Forbid()); } var team = _db.Team .FindByCondition(x => x.Id == teamId && x.ProjectId == projectId) .SingleOrDefault(); if (team == null) { return(BadRequest()); } team.Name = dto.Name; team.Description = dto.Description; team.HelpLink = dto.HelpLink; _db.Team.Update(team); _db.Save(); return(Ok(_mapper.Map <TeamDto>(team))); } catch (Exception e) { _logger.LogError($"ERROR in UpdateTeam: {e.Message}"); return(StatusCode(500, "Internal server error")); } }
/// <summary> /// 更新团队信息 /// </summary> /// <param name="dto"></param> /// <param name="openId"></param> /// <returns></returns> public async Task <bool> UpdateTeamAsync(UpdateTeamDto dto, string openId) { return(await _teameDal.UpdateTeamAsync(dto, openId)); }