Beispiel #1
0
        internal void ValidateRegistration(SqlCommand connection)
        {
            foreach (UserType userType in GetPermissions())
            {
                if (userType == UserType.Cliente)
                {
                    Client client = ClientRepo.FindClient(username, connection);
                    this.client = client != null ? client : CreateClient();
                }

                if (userType == UserType.Proveedor)
                {
                    Provider provider = ProviderRepo.FindProvider(username, connection);
                    this.provider = provider != null ? provider : CreateProvider();
                }
            }
        }
        public HttpResponseMessage GetProvidersList()
        {
            /*
             * List<Provider> prvdList = new List<Provider>();
             * using (DataContext db = new DataContext())
             * {
             *  var prvdQuery = from prvd in db.ProvidersList
             *                  select prvd;
             *  prvdList = prvdQuery.ToList();
             * }
             */
            ProviderRepo prvList = new ProviderRepo();
            var          json    = Newtonsoft.Json.JsonConvert.SerializeObject(prvList.GetProviders());

            return(new HttpResponseMessage()
            {
                Content = new StringContent(json.ToString(), System.Text.Encoding.UTF8, "application/json")
            });
        }
        public List <GetActiveProviders_Result> GetActiveProvidersData()
        {
            ProviderRepo repo = new ProviderRepo();

            return(repo.GetActiveProvider());
        }