Beispiel #1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            try
            {
                BookAddAttribute bookAddAttribute = await db.BookAddAttributes.FindAsync(id);

                db.BookAddAttributes.Remove(bookAddAttribute);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(PartialView("Error404"));
            }
        }
Beispiel #2
0
        // GET: BookAddAttributes/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            try
            {
                if (id == null)
                {
                    return(PartialView("Error404"));
                }
                BookAddAttribute bookAddAttribute = await db.BookAddAttributes.FindAsync(id);

                if (bookAddAttribute == null)
                {
                    return(PartialView("Error404"));
                }
                return(View(bookAddAttribute));
            }
            catch
            {
                return(PartialView("Error404"));
            }
        }
Beispiel #3
0
        public async Task <ActionResult> Edit([Bind(Include = "BookAddAttributesID,BookID,AttributeID,ValueTypeText,ValueTypeDate,Ganre,GanreID")] BookAddAttribute bookAddAttribute)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(bookAddAttribute).State = EntityState.Modified;
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
                ViewBag.BookID      = new SelectList(db.Books, "BookID", "Title", bookAddAttribute.BookID);
                ViewBag.AttributeID = new SelectList(db.ExtraAttributes, "AttributeID", "Name", bookAddAttribute.AttributeID);
                ViewBag.GanreID     = new SelectList(db.Ganres, "GanreID", "GanreName", bookAddAttribute.GanreID);
                return(View(bookAddAttribute));
            }
            catch
            {
                return(PartialView("Error404"));
            }
        }
Beispiel #4
0
        // GET: BookAddAttributes/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            try
            {
                if (id == null)
                {
                    return(PartialView("Error404"));
                }
                BookAddAttribute bookAddAttribute = await db.BookAddAttributes.FindAsync(id);

                if (bookAddAttribute == null)
                {
                    return(PartialView("Error404"));
                }
                ViewBag.BookID      = new SelectList(db.Books, "BookID", "Title", bookAddAttribute.BookID);
                ViewBag.AttributeID = new SelectList(db.ExtraAttributes, "AttributeID", "Name", bookAddAttribute.AttributeID);
                ViewBag.GanreID     = new SelectList(db.Ganres, "GanreID", "GanreName", bookAddAttribute.GanreID);
                return(View(bookAddAttribute));
            }
            catch
            {
                return(PartialView("Error404"));
            }
        }