コード例 #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);
        }
コード例 #2
0
ファイル: API.cs プロジェクト: yvanwang1992/Huaban
 public void SetToken(AuthToken token)
 {
     OAuthorAPI.setToken(token);
     UserAPI.setToken(token);
     CategoryAPI.setToken(token);
     PinAPI.setToken(token);
     BoardAPI.setToken(token);
 }
コード例 #3
0
ファイル: API.cs プロジェクト: yvanwang1992/Huaban
 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);
 }
コード例 #4
0
ファイル: API.cs プロジェクト: yvanwang1992/Huaban
 private API()
 {
     OAuthorAPI  = new OAuthorAPI("");
     UserAPI     = new UserAPI("");
     CategoryAPI = new CategoryAPI("");
     PinAPI      = new PinAPI("");
     BoardAPI    = new BoardAPI("");
 }
コード例 #5
0
 public CategoryView(long id)
 {
     InitializeComponent();
     _categoryApi        = new CategoryAPI();
     this.SubCategories  = this.getSubCategories(id);
     DataContext         = this;
     MainGridColumnCount = SubCategories.Count;
     // createDynamicWpfGrid(id);
 }
コード例 #6
0
 public MainWindow()
 {
     InitializeComponent();
     Router.Initialize(this);
     _categoryApi = new CategoryAPI();
     setCategories();
     this.ChildContent = new Home();
     this.DataContext  = this;
 }
コード例 #7
0
        public ActionResult Lista()
        {
            try
            {
                CategoryAPI api   = new CategoryAPI();
                var         lista = api.GetAll(Util.Configuracao.PerfilSelecionadoLogado.Cliente.Id);

                return(View(lista));
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #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
                    );
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: Coca162/Valour
        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();
        }
コード例 #10
0
        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));
        }
コード例 #11
0
 public CategoryListController()
 {
     _categoryApi = new CategoryAPI();
 }
コード例 #12
0
 public GalleryPictureController()
 {
     _categoryApi       = new CategoryAPI();
     _galleryPictureApi = new GalleryPictureAPI();
 }