public ReceiptsRepository( ApplicationDataContext dataContext, ILogger <ReceiptsRepository> logger ) { _dataContext = dataContext ?? throw new ArgumentNullException(nameof(dataContext)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public Teacher_OneToManyRelationship_Controller(ApplicationDataContext applicationDataContext, TeacherValidator validator, IMapper mapper) { _mapper = mapper; _validator = validator; _applicationDataContext = applicationDataContext; }
public List <BaseObject> ClientSerialize(ApplicationDataContext applicationDataContext) { ClientFactory factory = new ClientFactory("Клиентская"); ClientSerializer serializer = (ClientSerializer)factory.CreateSerializer(); string ClientSerealizedObjects = serializer.Serialize(applicationDataContext.Objects); return(serializer.Deserialize(ClientSerealizedObjects)); }
public UserClaimsPrincipalFactory( ApplicationDataContext dataContext, ILogger <UserClaimsPrincipalFactory> logger ) { _dataContext = dataContext ?? throw new ArgumentNullException(nameof(dataContext)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public List <BaseObject> BinarySerialize(ApplicationDataContext applicationDataContext) { BinaryFactory factory = new BinaryFactory("Бинарная"); BinarySerializer serializer = (BinarySerializer)factory.CreateSerializer(); string BinarySerealizedObjects = serializer.Serialize(applicationDataContext.Objects); return(serializer.Deserialize(BinarySerealizedObjects)); }
public UnitOfWork(ApplicationDataContext db, ILogger <PostRepository> log) { _db = db; _log = log; PostRepository = new PostRepository(_db, _log); LikeRepository = new LikeRepository(_db); commentRepository = new CommentRepository(_db); }
public LogBookRepository(ApplicationDataContext dataContext, IHttpContextAccessor httpContextAccessor, IGlobalRepository globalRepository, IMapper mapper) { _dataContext = dataContext; _httpContextAccessor = httpContextAccessor; _globalRepository = globalRepository; _mapper = mapper; }
public static string LoginUser(string userName, string Password) { using (var context = new ApplicationDataContext()) { string name = context.staffs.FirstOrDefault(s => s.user_name == userName && s.password == Password)?.first_name ?? string.Empty; return(name.ToString()); } }
public List <BaseObject> JsonSerialize(ApplicationDataContext applicationDataContext) { JsonFactory factory = new JsonFactory("Json"); JsonSerializer serializer = (JsonSerializer)factory.CreateSerializer(); string jsonSerealizedObjects = serializer.Serialize(applicationDataContext.Objects); return(serializer.Deserialize(jsonSerealizedObjects)); }
public ApplicationController() { using (ApplicationDataContext menu = new ApplicationDataContext()) { // loading data for menu control MenuRepository myMenu = new MenuRepository(); ViewData["menu"] = myMenu.MenuList(); } }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ApplicationDataContext db) { EntityMigration(db); Environment(app, env); UseCors(app); // UseAuthentication(app); UseMVC(app); UseReactSpa(app, env); }
public UnitOfWork(DbContextOptions <ApplicationDataContext> options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } _db = new ApplicationDataContext(options); }
private static void SeedEndereco(List <Endereco> enderecos, ApplicationDataContext context) { if (!context.Endereco.Any() && enderecos.Count > 0) { foreach (var endereco in enderecos) { context.Endereco.Add(endereco); } } }
public UsersRepository( ApplicationDataContext dataContext, IPrincipal principal, ILogger <UsersRepository> logger ) { _dataContext = dataContext ?? throw new ArgumentNullException(nameof(dataContext)); _principal = principal ?? throw new ArgumentNullException(nameof(principal)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public AuthenticationRepo(ApplicationDataContext dataContext, UserManager <User> userManager, SignInManager <User> signInManager, IHttpContextAccessor httpContextAccessor, IConfiguration configuration, IMapper mapper, IGlobalRepository globalRepository) { _dataContext = dataContext; _userManager = userManager; _signInManager = signInManager; _httpContextAccessor = httpContextAccessor; _configuration = configuration; _mapper = mapper; _globalRepository = globalRepository; }
private static void SeedCarrinho(List <Carrinho> carrinhos, ApplicationDataContext context) { if (!context.Carrinho.Any() && carrinhos.Count > 0) { foreach (var carrinho in carrinhos) { context.Carrinho.Add(carrinho); } } }
private static void SeedCliente(List <Cliente> clientes, ApplicationDataContext context) { if (!context.Cliente.Any() && clientes.Count > 0) { foreach (var cliente in clientes) { context.Cliente.Add(cliente); } } }
private static void SeedTelefone(List <Telefone> telefones, ApplicationDataContext context) { if (!context.Telefone.Any() && telefones.Count > 0) { foreach (var telefone in telefones) { context.Telefone.Add(telefone); } } }
private static void SeedProduto(List <Produto> produtos, ApplicationDataContext context) { if (!context.Produto.Any() && produtos.Count > 0) { foreach (var produto in produtos) { context.Produto.Add(produto); } } }
public override void ObjectDeleted(ApplicationDataContext CommonList) { for (int i = 0; i < CommonList.Objects.Count; i++) { Object CurrentObject = CommonList.Objects[i]; if (CurrentObject is Catalog && ((Catalog)CurrentObject).Filter == this) { ((Catalog)CurrentObject).Filter = null; } } }
public override void ObjectDeleted(ApplicationDataContext applicationDataContext) { for (int i = 0; i < applicationDataContext.Objects.Count; i++) { Object obj = applicationDataContext.Objects[i]; if (obj is WarPlane && ((WarPlane)obj).pilot == this) { ((WarPlane)obj).pilot = null; } } }
public IndustrialSupervisorRepo(ApplicationDataContext dataContext, UserManager <User> userManager, IGlobalRepository globalRepository, IAuthenticationRepo authenticationRepository, IMapper mapper, ICloudinaryRepository cloudinaryRepository) { _dataContext = dataContext; _userManager = userManager; _globalRepository = globalRepository; _mapper = mapper; _authenticationRepository = authenticationRepository; _cloudinaryRepository = cloudinaryRepository; }
private async Task MessageDeletedAsync(Cacheable <IMessage, ulong> arg1, ISocketMessageChannel arg2) { using (var db = new ApplicationDataContext()) { var msg = await DiscordMessage.CreateOrGetAsync(await arg1.GetOrDownloadAsync()); db.Entry(msg); msg.IsDeleted = true; await db.SaveChangesAsync(); } }
public StudentRepository(ApplicationDataContext dataContext, UserManager <User> userManager, IHttpContextAccessor httpContextAccessor, IGlobalRepository globalRepository, IAuthenticationRepo authenticationRepository, IMapper mapper, ICloudinaryRepository cloudinaryRepository) { _dataContext = dataContext; _userManager = userManager; _httpContextAccessor = httpContextAccessor; _globalRepository = globalRepository; _mapper = mapper; _authenticationRepository = authenticationRepository; _cloudinaryRepository = cloudinaryRepository; }
public void FillChat() { using (var context = new ApplicationDataContext()) { chart1.DataSource = context.Database.SqlQuery <SalesRec>("GetDayTotal").ToList(); // asigning a datasource to chart1 // assigning database variables to the chart X & Y members chart1.Series["BarChat"].XValueMember = "dates"; chart1.Series["BarChat"].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.String; chart1.Series["BarChat"].YValueMembers = "amount"; chart1.Series["BarChat"].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; } }
public async Task List_ReturnsAllSurveys() { using (var context = new ApplicationDataContext(_options)) { FeedDataContext(context, MockSurveys.AllSurveys); var repository = new SurveyRepository(context); var surveys = await repository.List(); Assert.NotNull(surveys); Assert.Equal(3, surveys.Count); } }
public async Task Create_AddsNewSurvey_ReturnsSurvey() { using (var context = new ApplicationDataContext(_options)) { var repository = new SurveyRepository(context); _ = await repository.Create(MockSurveys.iPhonePro); var surveys = context.Surveys.ToList(); Assert.NotNull(surveys); Assert.Single(surveys); Assert.Equal(MockSurveys.iPhonePro.Name, surveys.First().Name); } }
public async Task ListWithOptions_WhenExpressionPassed_ReturnsFilteredSurveyQuestions() { using (var context = new ApplicationDataContext(_options)) { FeedDataContext(context, MockSurveys.AllSurveys); var repository = new SurveyQuestionRepository(context); var surveys = await repository.ListWithOptions(MockSurveys.XiomiGuid); Assert.NotNull(surveys); Assert.Equal(2, surveys.Count); } }
public async Task List_WhenExpressionPassed_ReturnsFilteredSurveyQuestions() { using (var context = new ApplicationDataContext(_options)) { FeedDataContext(context, MockSurveys.AllSurveys); var repository = new SurveyQuestionRepository(context); var surveys = await repository.List(p => p.Title.Contains("white", StringComparison.InvariantCultureIgnoreCase)); Assert.NotNull(surveys); Assert.Equal(4, surveys.Count); } }
// GET: ExistingTables public ActionResult Index() { using (var context = new ApplicationDataContext()) { using (var unitOfWork = new UnitOfWork(context)) { var data = unitOfWork.Repository <ExistingTable>().Query().Select(); return(View(data.ToList())); } } return(View()); }