public async Task <IActionResult> Edit(int id, [Bind("Id,Number,Details,Type,Gender")] ShoeSize shoeSize)
        {
            if (id != shoeSize.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(shoeSize);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShoeSizeExists(shoeSize.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(shoeSize));
        }
Ejemplo n.º 2
0
        public void ShoeSizeConstructionPass()
        {
            Size   s    = new ShoeSize(43);
            string text = s.GetAsText();

            Assert.AreEqual("43", text);
        }
Ejemplo n.º 3
0
        public void TestOfShoeSizePrintPass()
        {
            Size s    = new ShoeSize(new int[42]);
            int  size = s.GetAsInt();

            Assert.AreEqual(42, size);
        }
Ejemplo n.º 4
0
        public ActionResult DeleteConfirmed(int id)
        {
            ShoeSize shoeSize = db.ShoeSizes.Find(id);

            db.ShoeSizes.Remove(shoeSize);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 5
0
 public ActionResult Edit([Bind(Include = "ShoeSizeID,Size")] ShoeSize shoeSize)
 {
     if (ModelState.IsValid)
     {
         db.Entry(shoeSize).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(shoeSize));
 }
Ejemplo n.º 6
0
        public ActionResult Create([Bind(Include = "ShoeSizeID,Size")] ShoeSize shoeSize)
        {
            if (ModelState.IsValid)
            {
                db.ShoeSizes.Add(shoeSize);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(shoeSize));
        }
        public async Task <IActionResult> Create([Bind("Id,Number,Details,Type,Gender")] ShoeSize shoeSize)
        {
            if (ModelState.IsValid)
            {
                _context.Add(shoeSize);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(shoeSize));
        }
Ejemplo n.º 8
0
        public HttpResponseMessage Convert([FromUri] double centimeters, [FromUri] string type)
        {
            UsShoeSizeConverter converter = new UsShoeSizeConverter();
            ShoeCategories      category  = ShoeCategories.Women;

            if (type.ToLower().Equals("men"))
            {
                category = ShoeCategories.Men;
            }
            ShoeSize size = converter.GetForCentimeters(centimeters, category);

            return(Request.CreateResponse(HttpStatusCode.OK, size));
        }
Ejemplo n.º 9
0
        // GET: ShoeSizes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ShoeSize shoeSize = db.ShoeSizes.Find(id);

            if (shoeSize == null)
            {
                return(HttpNotFound());
            }
            return(View(shoeSize));
        }
Ejemplo n.º 10
0
        public string ConvertShoeSize(ShoeSize shoeSize)
        {
            switch (shoeSize)
            {
            case ShoeSize.S39_5:
                return("39.5");

            case ShoeSize.S40:
                return("40");

            case ShoeSize.S40_5:
                return("40.5");

            case ShoeSize.S41:
                return("41");

            case ShoeSize.S41_5:
                return("41.5");
            }

            return(string.Empty);
        }