public string getListComics()
        {
            try
            {
                APIController      _api = new APIController();
                GetComicsViewModel _getComicsViewModel = new GetComicsViewModel();
                _getComicsViewModel.Format     = ComicFormat.Comic;
                _getComicsViewModel.FormatType = ComicFormatType.Comic;
                _getComicsViewModel.Limit      = 100;

                var _request = _api.Comics(_getComicsViewModel);

                var _seria = clsJson.Serialize(_request);
                var _root  = clsJson.Deserialize <RootObject>(_seria);

                List <ListComicsModel> _lstComicsModel = new List <ListComicsModel>();

                foreach (var _item in _root.Data)
                {
                    string _ima = (_item.Images.FirstOrDefault() != null) ? _item.Images.FirstOrDefault().Path + '.' + _item.Images.FirstOrDefault().Extension : "";
                    if (string.IsNullOrEmpty(_ima))
                    {
                        _ima = "Default";
                    }

                    string _fLan = (_item.Dates.Where(x => x.Type == "onsaleDate").FirstOrDefault() != null) ? _item.Dates.Where(x => x.Type == "onsaleDate").FirstOrDefault().Date2.ToString() :"";
                    if (string.IsNullOrEmpty(_fLan))
                    {
                        _fLan = "";
                    }
                    else
                    {
                        _fLan = System.Convert.ToDateTime(_fLan).ToString();
                    }

                    ListComicsModel _itemComicModel = new ListComicsModel();
                    _itemComicModel.Id               = _item.Id;
                    _itemComicModel.Imagen           = _ima;
                    _itemComicModel.Nombre           = _item.Title;
                    _itemComicModel.Volumen          = _item.IssueNumber.ToString();
                    _itemComicModel.FechaLanzamiento = _fLan;
                    _itemComicModel.Paginas          = _item.PageCount;
                    _itemComicModel.Descripcion      = _item.Description;
                    _lstComicsModel.Add(_itemComicModel);
                }


                return(json = clsJson.Serialize(_lstComicsModel.OrderBy(x => x.Nombre)));
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
        public string getComicsForBranc()
        {
            try
            {
                Repository _repo = new Repository();


                APIController      _api = new APIController();
                GetComicsViewModel _getComicsViewModel = new GetComicsViewModel();
                _getComicsViewModel.Format     = ComicFormat.Comic;
                _getComicsViewModel.FormatType = ComicFormatType.Comic;
                _getComicsViewModel.Limit      = 10;

                var _request = _api.Comics(_getComicsViewModel);

                var _seria = clsJson.Serialize(_request);
                var _root  = clsJson.Deserialize <RootObject>(_seria);

                List <ComicsStore> _list = _repo.GetComicsStore();

                List <ComicsStoreModel> _lstComicsModel = new List <ComicsStoreModel>();

                foreach (var _item in _list)
                {
                    int _codigo = Convert.ToInt32(_item.Codigo);
                    var _search = _root.Data.Where(x => x.Id == _codigo).FirstOrDefault();

                    if (_search != null)
                    {
                        ComicsStoreModel _itemComicModel = new ComicsStoreModel();
                        _itemComicModel.Check            = false;
                        _itemComicModel.IdProducto       = _item.IdProducto;
                        _itemComicModel.Codigo           = _codigo;
                        _itemComicModel.IdInventario     = _item.IdInventario;
                        _itemComicModel.NombreInventario = _item.NombreInventario;
                        _itemComicModel.IdSucursal       = _item.IdSucursal;
                        _itemComicModel.NombreSucursal   = _item.NombreSucursal;
                        _itemComicModel.Ubicacion        = _item.Ubicacion;
                        _itemComicModel.TituloComic      = _search.Title;
                        _itemComicModel.Formato          = _search.Format;
                        _itemComicModel.NumPaginas       = _search.PageCount;
                        _lstComicsModel.Add(_itemComicModel);
                    }
                }


                return(json = clsJson.Serialize(_lstComicsModel.OrderBy(x => x.TituloComic)));
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Esempio n. 3
0
        public JsonResult GetComics(GetComicsViewModel model)
        {
            IEnumerable <Comic> comics = _Marvel.GetComics(format: model.Format, formatType: model.FormatType, noVariants: model.NoVariants, dateDescript: model.Descriptor, hasDigitalIssue: model.HasDigitalIssue, order: model.Order, limit: model.Limit, offset: model.Offset);

            return(Json(comics));
        }
Esempio n. 4
0
        public JsonResult Comics(GetComicsViewModel model)
        {
            IEnumerable <Comic> comics = _Marvel.GetComics(Format: model.Format, FormatType: model.FormatType, NoVariants: model.NoVariants, DateDescript: model.Descriptor, HasDigitalIssue: model.HasDigitalIssue, Order: model.Order, Limit: model.Limit, Offset: model.Offset);

            return(Json(comics));
        }