Пример #1
0
 // 新增Category视图
 public ActionResult Create(int  CategoryParentId,string CategoryParentName)
 {
     CategoryModel model = new CategoryModel();
     model.CategoryParentId = CategoryParentId;
     model.CategoryParentName = CategoryParentName;
     return View();
 }
Пример #2
0
        public ActionResult Create(CategoryModel model)
        {
            try
            {
                CategoryDto dto = new CategoryDto();

                dto.CategoryName = model.CategoryName;
                dto.CategoryDescription = model.CategoryDescription;
                dto.CategoryParentId = model.CategoryParentId;

                string JsonString = JsonHelper.JsonSerializerBySingleData(dto);
                Message msg = CMSService.Insert("Category", JsonString);
                return RedirectTo("/Category/Index/" + model.CategoryParentId + "?CategoryParentName=" + model.CategoryParentName, msg.MessageInfo);
            }
            catch
            {
                Message msg = new Message();
                msg.MessageInfo = "插入操作出错了";
                ViewBag.Status = "Error";
                ViewBag.msg = msg.MessageInfo;
                return View();
            }
        }
Пример #3
0
        public ActionResult Edit(CategoryModel model)
        {
            CategoryDto dto = new CategoryDto();
                DataTable dt = CMSService.SelectOne("Category", "CMSCategory", "CategoryId=" + model.CategoryId);
                foreach (DataRow dr in dt.Rows)
                {

                    dto = CategoryMapping.getDTO(dr);
                    dto.CategoryId = model.CategoryId;
                    dto.CategoryName = model.CategoryName;
                    dto.CategoryDescription = model.CategoryDescription;
                    dto.CategoryParentId = model.CategoryParentId;
                }
                string JsonString = JsonHelper.JsonSerializerBySingleData(dto);
                Message msg = CMSService.Update("Category", JsonString);
                // TODO: Add update logic here

                return RedirectTo("/Category/Index/" + model.CategoryParentId + "?CategoryParentName=" + model.CategoryParentName, msg.MessageInfo);
        }
Пример #4
0
        // 编辑Category视图
        public ActionResult Edit(int id,string CategoryParentName)
        {
            CategoryModel model = new CategoryModel();
            DataTable dt = CMSService.SelectOne("Category", "CMSCategory", "CategoryId=" + id);
            foreach (DataRow dr in dt.Rows)
            {
                CategoryDto dto = new CategoryDto();
                dto = CategoryMapping.getDTO(dr);
                model.CategoryId = dto.CategoryId;
                model.CategoryName = dto.CategoryName;
                model.CategoryDescription = dto.CategoryDescription;
                model.CategoryParentId = dto.CategoryParentId;
                model.CategoryParentName = CategoryParentName;

            }

            return View(model);
        }