private void Validate(Validation_User model) { if (context.Users.Where(x => x.Username == model.Username && x.Id != model.UserId).Count() > 0) { throw new InvalidOperationException($"Потребителското име вече е заето."); } }
private void Validate(Validation_User model) { if (_context.Users.Where(x => x.Username == model.Username && x.Id != model.UserId).Count() > 0) { throw new InvalidOperationException($"User cant be created becuase there's already an existing user with the given username ({model.Username})"); } }