public void Insert(SuperPower superPower) { _context.SuperPowers.Add(superPower); _context.SaveChanges(); _auditService.Save(new AuditEvent { CreatedDate = DateTime.Now, Action = "Insert", Entity = "SuperPower", Id = superPower.Id }); }
public void Insert(SuperHero superHero) { _context.SuperHeroes.Add(superHero); _context.SaveChanges(); _auditService.Save(new AuditEvent { CreatedDate = DateTime.Now, Action = "Create", Entity = "SuperHero", Id = superHero.Id }); }
public User Create(User user, string password) { if (string.IsNullOrWhiteSpace(password)) { throw new AppException("Password is required"); } if (_context.Users.Any(x => x.Username == user.Username)) { throw new AppException("Username \"" + user.Username + "\" is already taken"); } _context.Users.Add(user); _context.SaveChanges(); return(user); }
public void Save(AuditEvent auditEvent) { _context.AuditEvents.Add(auditEvent); _context.SaveChanges(); }