Пример #1
0
        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));
        }
Пример #2
0
 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());
     }
 }