private DeleteTeam.Response DeleteTeamHandler(DeleteTeam command) { ITracer tracer = platform.Tracer; tracer.Write("Siemens-SimaticIT-Trace-Custom", Category.Informational, "Delete Team Start..."); try { var entity = platform.GetEntity <ITeam>(command.Id); if (entity == null) { return(new DeleteTeam.Response { Error = new ExecutionError(-1010, "删除的对象不存在") }); } platform.Delete(entity); tracer.Write("Siemens-SimaticIT-Trace-Custom", Category.Informational, "Delete Team End..."); return(new DeleteTeam.Response { }); } catch (Exception ex) { return(new DeleteTeam.Response { Error = new ExecutionError(-1010, string.Format("删除发生异常,异常信息是:{0}", ex.Message)) }); } }
public async Task DeleteTeam(DeleteTeam command) { await _administratorService.ValidateAtLeastAdministrator(command.UserId, command.GroupId); var group = await _groupRepository.GetWithTeamsAsync(command.GroupId); group.DeleteTeam(command.TeamName); await _groupRepository.SaveChangesAsync(); }
// Delete Team public HttpResult Delete(DeleteTeam request) { using (IDbTransaction trans = Db.OpenTransaction()) { Db.Delete<Teamate>(tm => tm.TeamId == request.Id); Db.DeleteById<Team>(request.Id); trans.Commit(); } return new HttpResult {StatusCode = HttpStatusCode.NoContent}; }
public async Task <IActionResult> Delete([FromBody] DeleteTeam data, [FromHeader] string CompanyId) { if (ModelState.IsValid) { data.UpdatedBy = User.Claims.FirstOrDefault(s => s.Type == "userName").Value; data.CompanyId = CompanyId; var result = await _deleteTeamRequestClient.Request(data); return(Ok(result)); } return(BadRequest(ModelState)); }
public async Task <ActionResult> DeleteTeam(Guid groupId, string teamName) { var command = new DeleteTeam { GroupId = groupId, UserId = User.GetUserId(), TeamName = teamName }; await _teamService.DeleteTeam(command); return(Ok()); }
private DeleteTeam.Response DeleteTeamHandler(DeleteTeam command) { try { var existEntity = platform.GetEntity <ITeam>(command.Id); if (existEntity != null) { platform.Delete(existEntity); } return(new DeleteTeam.Response()); } catch (Exception ex) { throw ex; } }