예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Archieve archieve = db.Archieves.Find(id);

            db.Archieves.Remove(archieve);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "Id,ProductId,UserId,DateTime,Ip")] Archieve archieve)
 {
     if (ModelState.IsValid)
     {
         db.Entry(archieve).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProductId = new SelectList(db.Products, "Id", "Name", archieve.ProductId);
     ViewBag.UserId    = new SelectList(db.Userses, "Id", "Name", archieve.UserId);
     return(View(archieve));
 }
예제 #3
0
        // GET: /Archeive/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Archieve archieve = db.Archieves.Find(id);

            if (archieve == null)
            {
                return(HttpNotFound());
            }
            return(View(archieve));
        }
예제 #4
0
        public ActionResult Create([Bind(Include = "Id,ProductId,UserId,DateTime,Ip")] Archieve archieve)
        {
            if (Session["type"] == null || Session["type"] == "")
            {
                Session["dv"] = "Create";
                Session["dc"] = "Archieve";
                return(RedirectToAction("Login", "Users"));
            }
            if (ModelState.IsValid)
            {
                db.Archieves.Add(archieve);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ProductId = new SelectList(db.Products, "Id", "Name", archieve.ProductId);
            ViewBag.UserId    = new SelectList(db.Userses, "Id", "Name", archieve.UserId);
            return(View(archieve));
        }
예제 #5
0
        // GET: /Archeive/Delete/5
        public ActionResult Delete(int?id)
        {
            if (Session["type"] == null || Session["type"] == "")
            {
                Session["dv"] = "Delete";
                Session["dc"] = "Archieve";
                return(RedirectToAction("Login", "Users"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Archieve archieve = db.Archieves.Find(id);

            if (archieve == null)
            {
                return(HttpNotFound());
            }
            return(View(archieve));
        }
예제 #6
0
        // GET: /Archeive/Edit/5
        public ActionResult Edit(int?id)
        {
            if (Session["type"] == null || Session["type"] == "")
            {
                Session["dv"] = "Edit";
                Session["dc"] = "Archieve";
                return(RedirectToAction("Login", "Users"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Archieve archieve = db.Archieves.Find(id);

            if (archieve == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ProductId = new SelectList(db.Products, "Id", "Name", archieve.ProductId);
            ViewBag.UserId    = new SelectList(db.Userses, "Id", "Name", archieve.UserId);
            return(View(archieve));
        }