Exemplo n.º 1
0
 public async Task EditAsync(TeamServiceModel team)
 {
     var t = await this._dbContext
                     .Teams
                     .Where(t => t.Id == team.Id)
                     .FirstOrDefaultAsync();
     t.Name = team.Name;
     
     await this._dbContext.SaveChangesAsync();
 }
Exemplo n.º 2
0
        public async Task UpdateAsync(TeamServiceModel input)
        {
            var team = await this.teamsRepository.GetByIdAsync(input.Id);

            team.Name   = input.Name;
            team.CityId = input.CityId;

            team.Services = new List <TeamService>();
            this.GenerateTeamServices(input, team);
            this.teamsRepository.Update(team);
            await this.teamsRepository.SaveChangesAsync();
        }
Exemplo n.º 3
0
        private void GenerateTeamServices(TeamServiceModel input, Team team)
        {
            foreach (var serviceId in input.Services)
            {
                var teamService = new TeamService()
                {
                    ServiceId = serviceId,
                    TeamId    = team.Id,
                };

                team.Services.Add(teamService);
            }
        }
Exemplo n.º 4
0
        public void SaveTeamDetails(TeamServiceModel TeamDetails)
        {
            var team = new TeamModel()
            {
                Id              = TeamDetails.Id,
                CompanyId       = TeamDetails.CompanyId,
                TeamCreatedDate = TeamDetails.TeamCreatedDate,
                Teamdesc        = TeamDetails.Teamdesc,
                TeamName        = TeamDetails.TeamName,
                TeamStatus      = TeamDetails.TeamStatus
            };

            _ITeamRepository.SaveTeamDetails(team);
        }
Exemplo n.º 5
0
        public JsonResult SaveDetails(TeamViewModelList team)
        {
            TeamServiceModel TeamModel;

            TeamModel = new TeamServiceModel()
            {
                Id              = team.Id,
                CompanyId       = team.CompanyId,
                TeamCreatedDate = team.TeamCreatedDate,
                Teamdesc        = team.Teamdesc,
                TeamName        = team.TeamName,
                TeamStatus      = team.TeamStatus
            };
            _ITeamService.SaveTeamDetails(TeamModel);
            bool success = true;

            return(Json(success, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 6
0
        public async Task <string> CreateAsync(TeamServiceModel input)
        {
            var team = new Team()
            {
                CityId = input.CityId,
                Name   = input.Name,
            };

            await this.teamsRepository.AddAsync(team);

            await this.teamsRepository.SaveChangesAsync();

            this.GenerateTeamServices(input, team);

            await this.teamsRepository.SaveChangesAsync();

            return(team.Id);
        }