public void DeleteAll() { using (var db = new EfEntities()) { db.Teams.Where(x => x.Deleted == false).Update(y => new Pb.Dal.Team() {Deleted = true, Modified = DateTime.Now}); db.SaveChanges(); } }
public void Create(Guid notificationId, string externalId) { using (var db = new Pb.Dal.EfEntities()) { Guid userId = db.Users.First(x => x.ExternalId == externalId).Id; db.NotificationPlayers.Add(new NotificationPlayer() { Id = Guid.NewGuid(), Created = DateTime.Now, NotificationId = notificationId, PlayerId = userId }); db.SaveChanges(); } }
public void Create(Team team) { team.Created = DateTime.Now; team.Modified = DateTime.Now; using (var db = new Pb.Dal.EfEntities()) { db.Teams.Add(new Pb.Dal.Team() { Id = team.Id == Guid.Empty ? Guid.NewGuid() : team.Id, Name = team.Name, Description = team.Description, Created = team.Created, Modified = team.Modified, Deleted = team.Deleted }); db.SaveChanges(); } }
public void Create(List<Team> teams) { teams.ForEach(x => { x.Created = DateTime.Now; x.Modified = DateTime.Now; }); using (var db = new Pb.Dal.EfEntities()) { foreach (var team in teams) { db.Teams.Add(new Pb.Dal.Team() { Id = team.Id == Guid.Empty ? Guid.NewGuid() : team.Id, Name = team.Name, Description = team.Description, Created = team.Created, Modified = team.Modified, Deleted = team.Deleted }); } db.SaveChanges(); } }
public void Update(User user) { using (var db = new Pb.Dal.EfEntities()) { db.Users.Where(x => x.Id == user.Id).Update(y => new Pb.Dal.User() {FirstName = user.FirstName, LastName = user.LastName, Callsign = user.Callsign, Modified = DateTime.Now}); db.SaveChanges(); } }
public void SetPassword(Guid userId, string password) { using (var db = new Pb.Dal.EfEntities()) { db.Users.Where(x => x.Id == userId).Update(y => new Pb.Dal.User() {Password = _encryptor.Encrypt(password), Modified = DateTime.Now}); db.SaveChanges(); } }
public void Delete(Guid id) { using (var db = new Pb.Dal.EfEntities()) { db.Users.Where(x => x.Id == id).Update(y => new Pb.Dal.User() {Deleted = true, Modified = DateTime.Now}); db.SaveChanges(); } }
public void Create(User user) { user.Created = DateTime.Now; user.Modified = DateTime.Now; //user.Password = _encryptor.Encrypt(user.Password); var efUser = ConvertUser(user); efUser.Password = ""; using (var db = new Pb.Dal.EfEntities()) { db.Users.Add(efUser); db.SaveChanges(); } }
public void Create(Domain.Rank rank) { var efRank = Mapper.Map<Pb.Dal.Rank>(rank); efRank.Id = efRank.Id == Guid.Empty ? Guid.NewGuid() : efRank.Id; efRank.Created = DateTime.Now; efRank.Modified = DateTime.Now; efRank.Deleted = false; using (var db = new Pb.Dal.EfEntities()) { db.Ranks.Add(efRank); db.SaveChanges(); } }
public void DeleteByTeamId(Guid teamId) { using (var db = new EfEntities()) { db.Ranks.Where(x => x.TeamId == teamId && x.Deleted == false).Update(y=> new Pb.Dal.Rank() {Deleted = true, Modified = DateTime.Now }); db.SaveChanges(); } }
public void Update(TeamModel team) { using (var db = new EfEntities()) { db.Teams.Where(x => x.Deleted == false && x.Id == team.Id).Update(y => new Pb.Dal.Team() { Modified = DateTime.Now, Description = team.Description, ImageUrl = team.ImageUrl, Name = team.Name }); db.SaveChanges(); } }