public Int64 createDefaultTeam(int comapanyid, int teamsetid)
        {
            var team = new Team { TeamSetID = teamsetid, Name = "Global", Description="Global", CompanyID = comapanyid, IsDeleted = false, CreatedTime = DateTime.Now, ModifiedTime = DateTime.Now };
            context.Teams.Add(team);
               context.SaveChanges();
             Int64 id = team.TeamID;

            return id;
        }
Exemple #2
0
 public Int64 TeamsInsertOrUpdate(Team team)
 {
     ValidateTeam(team);
      return teamRepository.TeamsInsertOrUpdate(team);
 }
Exemple #3
0
 private void ValidateTeam(Team team)
 {
     string name = team.Name;
     long id = team.TeamID;
     bool oneteam = teamRepository.SearchTeam(name, id);
     if (oneteam == true)
     {
         throw new TeamException(String.Format("This Team name already exists. Please try another one.", name));
     }
 }
        public long TeamsInsertOrUpdate(Team team)
        {
            long tid = team.TeamID;
            if(tid == 0)
                context.Entry(team).State = EntityState.Added ;
            else
                context.Entry(team).State = EntityState.Modified;

            context.SaveChanges();
            long id = team.TeamID;
            return id;
        }