public async Task <IActionResult> AddTeam([FromBody] TeamViewModel teamViewModel) { var companyId = this.User.Claims.SingleOrDefault(c => c.Type == "companyId").Value; var team = mapper.Map <Team>(teamViewModel); team.CompanyId = companyId; team = await teamProvider.AddTeam(team); teamViewModel = mapper.Map <TeamViewModel>(team); return(Ok(teamViewModel)); }
public ActionResult AddTeam(Team team) { if (ModelState.IsValid) { bool result = teamProvider.AddTeam(team); if (!result) { log.Error("Controller: Team, Action: AddTeam Don't add Team"); } return(RedirectToAction("ShowTeams")); } else { return(View()); } }