Exemple #1
0
        private async Task <IEnumerable <Pin> > GetData(uint startIndex, int page)
        {
            PinListVM.PinList.HasMore();

            IsLoading = true;
            try
            {
                var list = await CategoryAPI.GetCategoryPinList("/all/", 20, PinListVM.GetMaxPinID());

                if (list?.Count == 0)
                {
                    PinListVM.PinList.NoMore();
                }
                else
                {
                    PinListVM.PinList.HasMore();
                }
                return(list);
            }
            catch (Exception ex)
            {
            }
            finally
            {
                IsLoading = false;
            }
            return(null);
        }
Exemple #2
0
 public void SetToken(AuthToken token)
 {
     OAuthorAPI.setToken(token);
     UserAPI.setToken(token);
     CategoryAPI.setToken(token);
     PinAPI.setToken(token);
     BoardAPI.setToken(token);
 }
Exemple #3
0
 public void Init(string id, string secret, string callback, string md)
 {
     OAuthorAPI.setup(id, secret, callback, md);
     UserAPI.setup(id, secret, callback, md);
     CategoryAPI.setup(id, secret, callback, md);
     PinAPI.setup(id, secret, callback, md);
     BoardAPI.setup(id, secret, callback, md);
 }
Exemple #4
0
 private API()
 {
     OAuthorAPI  = new OAuthorAPI("");
     UserAPI     = new UserAPI("");
     CategoryAPI = new CategoryAPI("");
     PinAPI      = new PinAPI("");
     BoardAPI    = new BoardAPI("");
 }
Exemple #5
0
 public CategoryView(long id)
 {
     InitializeComponent();
     _categoryApi        = new CategoryAPI();
     this.SubCategories  = this.getSubCategories(id);
     DataContext         = this;
     MainGridColumnCount = SubCategories.Count;
     // createDynamicWpfGrid(id);
 }
 public MainWindow()
 {
     InitializeComponent();
     Router.Initialize(this);
     _categoryApi = new CategoryAPI();
     setCategories();
     this.ChildContent = new Home();
     this.DataContext  = this;
 }
        public ActionResult Lista()
        {
            try
            {
                CategoryAPI api   = new CategoryAPI();
                var         lista = api.GetAll(Util.Configuracao.PerfilSelecionadoLogado.Cliente.Id);

                return(View(lista));
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #8
0
        private void loadCategory(ProductViewModel model)
        {
            // Carrega categorias
            CategoryAPI categoryAPI = new CategoryAPI();
            var         lista       = categoryAPI.GetAll(Util.Configuracao.PerfilSelecionadoLogado.Cliente.Id);

            model.CategoryList =
                new SelectList(
                    lista
                    .Select
                    (
                        s => new ListItemModel()
            {
                Id   = s.Id,
                Text = s.Name.ToUpper()
            }
                    ), "Id", "Text", model.Id
                    );
        }
Exemple #9
0
        public static void Main(string[] args)
        {
            // Load configs
            LoadConfigsAsync();

            // Create builder
            var builder = WebApplication.CreateBuilder(args);

            builder.Host.ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseUrls("http://localhost:3000", "https://localhost:3001");
            });

            // Set up services
            ConfigureServices(builder);

            // Build web app
            var app = builder.Build();

            // Configure application
            ConfigureApp(app);

            app.MapGet("/api/ping", () => "pong");

            // Add API routes
            BaseAPI.AddRoutes(app);
            UploadAPI.AddRoutes(app);
            ChannelAPI.AddRoutes(app);
            CategoryAPI.AddRoutes(app);
            PlanetAPI.AddRoutes(app);
            UserAPI.AddRoutes(app);
            MemberAPI.AddRoutes(app);
            RoleAPI.AddRoutes(app);
            EmbedAPI.AddRoutes(app);

            // Run
            app.Run();
        }
        public ActionResult Form(CategoryViewModel model)
        {
            try
            {
                if (string.IsNullOrEmpty(model.Name))
                {
                    throw new Exception("Informe a Categoria.");
                }

                if (model.Id == 0)
                {
                    model.StoreId = Util.Configuracao.PerfilSelecionadoLogado.Cliente.Id;

                    CategoryAPI   api     = new CategoryAPI();
                    CategoryModel created = (api.Create(model.Cast <CategoryModel>()));

                    model.ReturnAttribute.Status   = Helpers.Constantes.StatusRetorno.Sucesso;
                    model.ReturnAttribute.Mensagem = "Nova categoria cadastrada com sucesso!";
                    model.Id = created.Id;
                }
                else
                {
                    // Chamar PUT

                    model.ReturnAttribute.Status   = Helpers.Constantes.StatusRetorno.Sucesso;
                    model.ReturnAttribute.Mensagem = "Categoria alterada com sucesso!";
                }
            }
            catch (Exception ex)
            {
                model.ReturnAttribute.Titulo   = "Erro ao editar categoria";
                model.ReturnAttribute.Mensagem = ex.Message;
                model.ReturnAttribute.Status   = Helpers.Constantes.StatusRetorno.Erro;
            }

            return(View(model));
        }
 public CategoryListController()
 {
     _categoryApi = new CategoryAPI();
 }
Exemple #12
0
 public GalleryPictureController()
 {
     _categoryApi       = new CategoryAPI();
     _galleryPictureApi = new GalleryPictureAPI();
 }