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 add()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <List <JGN_BadgeCategories> >(json);

            foreach (var category in data)
            {
                if (category.id > 0)
                {
                    GA_CategoryBLL.Update(_context, category);
                }
                else
                {
                    var obj = GA_CategoryBLL.Add(_context, category);
                    category.id = obj.id;
                }

                /*if(category.isdeleted && category.id > 0)
                 * {
                 *  GA_CategoryBLL.Delete(category.id);
                 * }
                 * else if(category.edit && category.id > 0)
                 * {
                 *  GA_CategoryBLL.Update(category);
                 * }
                 * else if(category.id == 0)
                 * {
                 *  var obj = GA_CategoryBLL.Add(category);
                 *  category.id = obj.id;
                 * }
                 */
            }

            return(Ok(new { status = "success", record = data, message = "Record processed successfully" }));
        }
Exemplo n.º 3
0
        public ActionResult action()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <List <GACategoryEntity> >(json);

            GA_CategoryBLL.ProcessAction(_context, data);

            return(Ok(new { status = "success", message = "Operation performed successfully" }));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> load()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <GACategoryEntity>(json);

            var _posts = await GA_CategoryBLL.Load(_context, data);

            var _records = 0;

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


            return(Ok(new { posts = _posts, records = _records }));
        }