Esempio n. 1
0
 // GET: AdminPanel/SizeColors/Delete/5
 public ActionResult Delete(int? id )
 {
     SizeColor sizeColor = db.SizeColors.Find(id);
     db.SizeColors.Remove(sizeColor);
     db.SaveChanges();
     return Redirect("/AdminPanel/SizeColors/Index/" + sizeColor.ProductId);
 }
Esempio n. 2
0
 public ActionResult Edit([Bind(Include = "Id,SizeId,ColorId,ProductId")] SizeColor sizeColor,int? id)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sizeColor).State = EntityState.Modified;
         db.SaveChanges();
         var sizecolor = db.SizeColors.Find(id);
         return Redirect("/adminPanel/SizeColors/Index/"+ sizeColor.ProductId);
     }
     ViewBag.ColorId = new SelectList(db.Colors, "Id", "NameColor", sizeColor.ColorId);
     ViewBag.ProductId = new SelectList(db.Products, "Id", "Name", sizeColor.ProductId);
     ViewBag.SizeId = new SelectList(db.Sizes, "Id", "NameSize", sizeColor.SizeId);
     return PartialView(sizeColor);
 }
Esempio n. 3
0
        public ActionResult Create([Bind(Include = "Id,SizeId,ColorId,ProductId")] SizeColor sizeColor ,int? id)
        {
            if (ModelState.IsValid)
            {
                db.SizeColors.Add(sizeColor);
                db.SaveChanges();
                return Redirect("/AdminPanel/SizeColors/Index/" + id);
            }

            ViewBag.ColorId = new SelectList(db.Colors, "Id", "NameColor", sizeColor.ColorId);
            ViewBag.ProductId = new SelectList(db.Products.Where(p => p.Id == id).ToList(), "Id", "Name", sizeColor.ProductId);
            ViewBag.SizeId = new SelectList(db.Sizes, "Id", "NameSize", sizeColor.SizeId);
            return PartialView(sizeColor);
        }
Esempio n. 4
0
 // GET: AdminPanel/SizeColors/Edit/5
 public ActionResult Edit(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     SizeColor sizeColor = db.SizeColors.Find(id);
     if (sizeColor == null)
     {
         return HttpNotFound();
     }
     ViewBag.ColorId = new SelectList(db.Colors, "Id", "NameColor", sizeColor.ColorId);
     ViewBag.ProductId = new SelectList(db.Products.Where(p=>p.Id==sizeColor.ProductId), "Id", "Name", sizeColor.ProductId);
     ViewBag.SizeId = new SelectList(db.Sizes, "Id", "NameSize", sizeColor.SizeId);
     return View(sizeColor);
 }
Esempio n. 5
0
        public IActionResult prosizecolor(SizeColor obj)
        {
            try
            {
                //   obj.ProductId=HttpContext.Session.GetInt32("product_id");

                pro1.SizeColor.Add(obj);
                pro1.SaveChanges();
                TempData["proid"] = HttpContext.Session.GetInt32("proid");
                return(RedirectToAction("prosizecolor"));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                ViewBag.error = e.Message;
                return(View());
            }
        }
Esempio n. 6
0
        public DetailPrototypesManager(Mod mod, Transform parent, RealGrassOptions options, PrototypesProperties properties)
        {
            Color healthyColor = new Color(0.70f, 0.70f, 0.70f);
            Color dryColor     = new Color(0.40f, 0.40f, 0.40f);

            this.mod        = mod;
            this.parent     = parent;
            this.options    = options;
            textureOverride = properties.TextureOverride;
            float noiseSpread = properties.NoiseSpread;

            useGrassShader = properties.UseGrassShader;

            List <DetailPrototype> detailPrototypes = new List <DetailPrototype>();
            int index = 0;

            var grassPrototypes = new DetailPrototype()
            {
                minWidth         = properties.GrassWidth.Min,
                maxWidth         = properties.GrassWidth.Max,
                noiseSpread      = properties.NoiseSpread,
                renderMode       = useGrassShader ? DetailRenderMode.Grass : DetailRenderMode.GrassBillboard,
                usePrototypeMesh = useGrassShader
            };

            detailPrototypes.Add(grassPrototypes);
            Grass = index;

            if ((options.GrassStyle & GrassStyle.Mixed) == GrassStyle.Mixed)
            {
                detailPrototypes.Add(new DetailPrototype()
                {
                    minWidth         = properties.GrassWidth.Min,
                    maxWidth         = properties.GrassWidth.Max,
                    noiseSpread      = properties.NoiseSpread,
                    healthyColor     = healthyColor,
                    dryColor         = dryColor,
                    renderMode       = useGrassShader ? DetailRenderMode.Grass : DetailRenderMode.GrassBillboard,
                    usePrototypeMesh = useGrassShader
                });
                GrassDetails = ++index;

                detailPrototypes.Add(new DetailPrototype()
                {
                    minWidth         = properties.GrassWidth.Min,
                    maxWidth         = properties.GrassWidth.Max,
                    noiseSpread      = properties.NoiseSpread,
                    healthyColor     = healthyColor,
                    dryColor         = dryColor,
                    renderMode       = useGrassShader ? DetailRenderMode.Grass : DetailRenderMode.GrassBillboard,
                    usePrototypeMesh = useGrassShader
                });
                GrassAccents = ++index;
            }

            if (options.WaterPlants)
            {
                var waterPlantsNear = new DetailPrototype()
                {
                    usePrototypeMesh = true,
                    noiseSpread      = 0.6f,
                    healthyColor     = healthyColor,
                    dryColor         = dryColor,
                    renderMode       = DetailRenderMode.Grass
                };
                detailPrototypes.Add(waterPlantsNear);
                WaterPlants = ++index;
            }

            if (options.TerrainStones)
            {
                detailPrototypes.Add(new DetailPrototype()
                {
                    minWidth         = 0.4f,
                    maxWidth         = 1,
                    minHeight        = 0.25f,
                    maxHeight        = 1.5f,
                    usePrototypeMesh = true,
                    noiseSpread      = 1,
                    renderMode       = DetailRenderMode.VertexLit
                });
                Rocks = ++index;
            }

            DetailPrototypes = detailPrototypes.ToArray();

            GrassColors   grassColors = properties.GrassColors;
            Range <float> grassHeight = properties.GrassHeight;

            sizeColor = grassColors.SeasonInterpolation ?
                        new InterpolatedSizeColor(options.GrassStyle, grassColors, grassHeight, noiseSpread, detailPrototypes[Grass], detailPrototypes[GrassDetails], detailPrototypes[GrassAccents]) :
                        new SizeColor(options.GrassStyle, grassColors, grassHeight, noiseSpread, detailPrototypes[Grass], detailPrototypes[GrassDetails], detailPrototypes[GrassAccents]);
        }