Example #1
0
        public ActionResult Delete(int ID)
        {
            TagActionModel model = new TagActionModel();

            var tag = services.GetTagByID(ID);

            model.TagID = tag.TagID;

            return(PartialView("_Delete", model));
        }
Example #2
0
        public ActionResult AddAndEdit(int?ID)
        {
            TagActionModel model = new TagActionModel();

            if (ID.HasValue)
            {
                var suppler = services.GetTagByID(ID.Value);

                model.TagID = suppler.TagID;

                model.TagTitle = suppler.TagTitle;
            }
            return(PartialView("_AddAndEdit", model));
        }
Example #3
0
        public JsonResult Delete(TagActionModel model)
        {
            JsonResult json = new JsonResult();

            var result = false;

            var tag = services.GetTagByID(model.TagID);

            result = services.DeleteTag(tag);

            if (result)
            {
                json.Data = new { Success = true };
            }
            else
            {
                json.Data = new { Success = false, Message = "Unable to perform any action" };
            }

            return(json);
        }
Example #4
0
        public JsonResult AddAndEdit(TagActionModel model)
        {
            JsonResult json = new JsonResult();

            var result = false;

            if (model.TagID > 0)
            {
                var tag = services.GetTagByID(model.TagID);

                tag.TagTitle = model.TagTitle;

                tag.UpdatedAt = DateTime.Now;

                result = services.UpdateTag(tag);
            }
            else
            {
                Tag tag = new Tag();

                tag.TagTitle = model.TagTitle;

                tag.UpdatedAt = DateTime.Now;

                result = services.SaveTag(tag);
            }

            if (result)
            {
                json.Data = new { Success = true };
            }
            else
            {
                json.Data = new { Success = false, Message = "Unable to perform any action" };
            }

            return(json);
        }