Exemplo n.º 1
0
        public ActionResult CreateProductResource([FetchProduct(KeyName = "sid")] ProductEntity productEntity)
        {
            var vo = new ResourceViewModel();
            vo.SourceId = productEntity.Id;
            vo.SourceType = (int)SourceType.Product;

            return Create(vo);
        }
Exemplo n.º 2
0
        public ActionResult Create(FormCollection formCollection, ResourceViewModel vo)
        {
            if (ControllerContext.HttpContext.Request.Files != null && vo.SourceId > 0 && vo.SourceType > 0)
            {
                //处理 图片
                //处理文件上传

                var ids = _resourceService.Save(ControllerContext.HttpContext.Request.Files, base.CurrentUser.CustomerId, -1, vo.SourceId, (SourceType)vo.SourceType);

                if (ids != null && ids.Count > 0)
                {
                    return Success("/" + RouteData.Values["controller"] + "/list");
                }
            }

            return View(vo);
        }
Exemplo n.º 3
0
        public ActionResult Edit(FormCollection formCollection, [FetchResource(KeyName = "id")]ResourceEntity entity, ResourceViewModel vo)
        {

            if (entity == null || !ModelState.IsValid)
            {
                ModelState.AddModelError("", "参数验证失败.");
                return View(vo);
            }

            entity.SourceId = vo.SourceId;
            entity.SourceType = vo.SourceType;
            entity.Name = vo.Name;
            entity.ExtName = vo.ExtName;
            entity.Domain = vo.Domain;
            entity.IsDefault = vo.IsDefault;
            entity.SortOrder = vo.SortOrder;
            entity.Type = vo.Type;
            entity.UpdatedDate = DateTime.Now;
            _resourceRepository.Update(entity);


            return RedirectToAction("Details", new { id = entity.Id });
        }
Exemplo n.º 4
0
 public ActionResult Create(ResourceViewModel vo)
 {
     return View("Create", vo);
 }