/// <summary> /// Authorize /// </summary> /// <param name="clientName">string</param> /// <param name="clientToken">string</param> /// <returns></returns> private Guid? Authorize(string clientName, string clientToken) { using (var context = new Entities()) { var client = context.VF_API_CATALOG_CLIENTS.Where(e => e.CLIENT_NAME == clientName && e.CLIENT_TOKEN == clientToken && e.CLIENT_STATUS == true).FirstOrDefault(); if (client != null) { return client.CLIENT_ID; } return null; } }
public async Task<int> Save(VF_API_CATALOG_CLIENTS client) { using (var context = new Entities()) { if (client.TRANSDEV_ID == 0) { context.Entry(client).State = EntityState.Added; } else { context.Entry(client).State = EntityState.Modified; } return await context.SaveChangesAsync(); } }
public async Task<int> Save(VF_API_CLIENT_OBJECTS clientObject) { using (var context = new Entities()) { if (clientObject.CLIENT_OBJECT_ID == System.Guid.Empty) { clientObject.CLIENT_OBJECT_ID = System.Guid.NewGuid(); context.Entry(clientObject).State = EntityState.Added; } else { context.Entry(clientObject).State = EntityState.Modified; } return await context.SaveChangesAsync(); } }
/// <summary> /// Execute DataProvide /// </summary> /// <param name="clients">VF_API_CLIENT_OBJECTS</param> /// <returns>QueryResult of DataTable</returns> public async Task<QueryResult<DataTable>> Execute(VF_API_CLIENT_OBJECTS client) { using (var context = new Entities()) { var adaptor = new SqlServerTableAdaptor(); var parameters = new SqlServerTableParameters(); parameters.UserID = client.DB_USER; parameters.Password = client.DB_USER_PASSWORD; parameters.DataSource = client.DB_SERVER_NAME; parameters.InitialCatalog = client.DB_NAME; parameters.IntegratedSecurity = client.DB_INTEGRATED_SECURITY; parameters.ObjectName = client.DB_OBJECT_NAME; parameters.SchemaName = client.DB_SCHEMA; return adaptor.Execute(parameters); } }
public IQueryable<VF_API_CLIENT_OBJECTS> GetAll() { var context = new Entities(); return context.VF_API_CLIENT_OBJECTS.Include(e => e.VF_API_CATALOG_CLIENTS).AsQueryable(); }
/// <summary> /// Gets all. /// </summary> /// <returns></returns> public IQueryable<VF_API_CATALOG_CLIENTS> GetAll() { var context = new Entities(); return context.VF_API_CATALOG_CLIENTS.AsQueryable(); }
/// <summary> /// Get Providers /// </summary> /// <returns></returns> public IQueryable<VF_DATA_PROVIDER> GetProviders() { var context = new Entities(); return context.VF_DATA_PROVIDER.AsQueryable(); }