Exemplo n.º 1
0
        public async Task <IActionResult> load()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <BadgeEntity>(json);

            // load all badges
            var _posts = await BadgeBLL.Load(_context, data);

            // load all categories
            var _categories = await GA_CategoryBLL.Load(_context, new GACategoryEntity()
            {
            });

            foreach (var item in _posts)
            {
                item.img_url = UrlConfig.Return_Badge_Image(item.icon);
            }

            var _records = 0;

            if (data.id == 0)
            {
                _records = BadgeBLL.Count(_context, data);
            }


            return(Ok(new { posts = _posts, records = _records, categories = _categories }));
        }
Exemplo n.º 2
0
        public ActionResult action()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <List <BadgeEntity> >(json);

            BadgeBLL.ProcessAction(_context, data);

            return(Ok(new { status = "success", message = "Operation performed successfully" }));
        }
Exemplo n.º 3
0
        public ActionResult updatephoto()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <List <BadgeEntity> >(json);

            foreach (var item in data)
            {
                BadgeBLL.Update_Field_V3(_context, item.id, item.icon, "icon");
            }

            return(Ok(new { status = "success", message = "Photo information upated" }));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> getinfo()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <BadgeEntity>(json);

            // load all badges
            var _posts = await BadgeBLL.Load(_context, data);

            foreach (var item in _posts)
            {
                item.img_url = UrlConfig.Return_Badge_Image(item.icon);
            }

            return(Ok(new { posts = _posts }));
        }
Exemplo n.º 5
0
        public async Task <ActionResult> add()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <JGN_Badges>(json);

            if (data.id > 0)
            {
                /* update record */
                data = await BadgeBLL.Update(_context, data);
            }
            else
            {
                /* add record */
                data = await BadgeBLL.Add(_context, data);
            }

            data.img_url = UrlConfig.Return_Badge_Image(data.icon);

            return(Ok(new { status = "success", record = data, message = "Record processed successfully" }));
        }