public async Task <IActionResult> Edit(int id, [Bind("FootwearId,Name")] Footwear footwear)
        {
            if (id != footwear.FootwearId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(footwear);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FootwearExists(footwear.FootwearId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(footwear));
        }
예제 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Footwear footwear = db.Footwears.Find(id);

            db.Footwears.Remove(footwear);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> Create([Bind("FootwearId,Name")] Footwear footwear)
        {
            if (ModelState.IsValid)
            {
                _context.Add(footwear);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(footwear));
        }
예제 #4
0
 public ActionResult Edit([Bind(Include = "FootwearID,FootwearName,FootwearPhoto,Type,SeasonID,OccasionID")] Footwear footwear)
 {
     if (ModelState.IsValid)
     {
         db.Entry(footwear).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.OccasionID = new SelectList(db.Occasions, "OccasionID", "Occasion1", footwear.OccasionID);
     ViewBag.SeasonID   = new SelectList(db.Seasons, "SeasonID", "Season1", footwear.SeasonID);
     return(View(footwear));
 }
예제 #5
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Footwear footwear = dbContext.Footwear.Find(id);

            if (footwear == null)
            {
                return(HttpNotFound());
            }
            return(View(footwear));
        }
예제 #6
0
        // GET: Footwears/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Footwear footwear = db.Footwears.Find(id);

            if (footwear == null)
            {
                return(HttpNotFound());
            }
            ViewBag.OccasionID = new SelectList(db.Occasions, "OccasionID", "Occasion1", footwear.OccasionID);
            ViewBag.SeasonID   = new SelectList(db.Seasons, "SeasonID", "Season1", footwear.SeasonID);
            return(View(footwear));
        }
예제 #7
0
 private void Awake()
 {
     nullFootwear = Resources.Load <Footwear>(NullEquipmentsRef.noFootwear);
 }