Пример #1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Strap strap = await db.Straps.FindAsync(id);

            db.Straps.Remove(strap);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Пример #2
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,StrapName")] Strap strap)
        {
            if (ModelState.IsValid)
            {
                db.Entry(strap).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(strap));
        }
Пример #3
0
        public async Task <ActionResult> Create([Bind(Include = "Id,StrapName")] Strap strap)
        {
            if (ModelState.IsValid)
            {
                db.Straps.Add(strap);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(strap));
        }
Пример #4
0
        public void TestMethodStrap()
        {
            Strap strap = new Strap();

            strap.Width                = 1;
            strap.PerforationRadius    = 10;
            strap.NumberOfPerforations = 100;
            strap.Length               = 1000;

            Assert.AreEqual(strap.Width, 1);
            Assert.AreEqual(strap.PerforationRadius, 10);
            Assert.AreEqual(strap.NumberOfPerforations, 100);
            Assert.AreEqual(strap.Length, 1000);
        }
Пример #5
0
        // GET: Admin/Strap/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Strap strap = await db.Straps.FindAsync(id);

            if (strap == null)
            {
                return(HttpNotFound());
            }
            return(View(strap));
        }