Esempio n. 1
0
        public ActionResult Edit(int id)
        {
            ViewBag.Error = "none";
            MldProduct            model       = dal.Query(id);
            MldProductCategoryDal categoryDal = new MldProductCategoryDal();
            MldProductCategory    category    = categoryDal.Query(model.Cid);

            ViewBag.TopCategoryID = categoryDal.Query(category.Tid).ID;
            ViewBag.Category1     = categoryDal.QueryList("id asc", "tid=@1", 0);
            ViewBag.Category2     = categoryDal.QueryList("id asc", "tid=@1", category.Tid);
            return(View(model));
        }
        public ActionResult Index(int tid, string name, int order)
        {
            ViewBag.Error = "none";
            MldProductCategory model = new MldProductCategory();

            model.Tid   = tid;
            model.Name  = name;
            model.Order = order;
            if (dal.Add(model) > 0)
            {
                ViewBag.Success = "ok";
            }
            else
            {
                ViewBag.Error = "Error";
            }
            return(View());
        }
        public ActionResult Edit(int id, int tid, string name, int order)
        {
            ViewBag.Error = "none";

            MldProductCategory model = dal.Query(id);

            model.Tid   = tid;
            model.Name  = name;
            model.Order = order;

            if (dal.Update(model))
            {
                ViewBag.Success = "ok";
            }
            else
            {
                ViewBag.Error = "Error";
            }
            return(View(model));
        }
Esempio n. 4
0
        public ActionResult Edit(int id, int cid, string name, string subhead, string profile, string application, string material, string weight, string length, string massOfInertia, string sectionModulus, HttpPostedFileBase profileimg, HttpPostedFileBase img, string content, string datacontent, int allshowflag, int homeshowflag, int iselite)
        {
            ViewBag.Error     = "none";
            ViewBag.Category1 = new MldProductCategoryDal().QueryList("id asc", "tid=@1", 0);
            MldProduct model  = dal.Query(id);
            string     imgUrl = model.Img;

            if (img != null && img.ContentLength > 0)
            {
                UploadFileResult result = img.FileUpLoad("img", 1024 * 1024 * 4, "product");
                if (!result.Ok)
                {
                    ViewBag.Error = result.Data;
                }
                else
                {
                    imgUrl = result.Data;
                }
            }



            model.Img          = imgUrl;
            model.Cid          = cid;
            model.Name         = name;
            model.SubHead      = subhead;
            model.Content      = content;
            model.AllShowFlag  = allshowflag;
            model.HomeShowFlag = homeshowflag;
            model.IsElite      = iselite;

            model.Profile        = profile;
            model.Application    = application;
            model.Material       = material;
            model.Weight         = weight;
            model.Length         = length;
            model.MassOfInertia  = massOfInertia;
            model.SectionModulus = sectionModulus;

            if (profileimg != null && profileimg.ContentLength > 0)
            {
                UploadFileResult result = profileimg.FileUpLoad("img", 1024 * 1024 * 4, "product");
                if (result.Ok)
                {
                    model.ProfileImg = result.Data;
                }
            }

            if (dal.Update(model))
            {
                ViewBag.Success = "ok";
            }
            else
            {
                ViewBag.Error = "Error";
            }

            MldProductCategoryDal categoryDal = new MldProductCategoryDal();

            model = dal.Query(id);
            MldProductCategory category = categoryDal.Query(model.Cid);

            ViewBag.TopCategoryID = categoryDal.Query(category.Tid).ID;
            ViewBag.Category1     = categoryDal.QueryList("id asc", "tid=@1", 0);
            ViewBag.Category2     = categoryDal.QueryList("id asc", "tid=@1", category.Tid);
            return(View(model));
        }