Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            UserShipment userShipment = db.UserShipments.Find(id);

            db.UserShipments.Remove(userShipment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "UserShipId,UserID,Invoice,Name,Surname,Country,City,ZipCode,Street,NumberHouse,NumberFlat,Telephone,AdditionalInfo")] UserShipment userShipment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userShipment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserID = new SelectList(db.Users, "Id", "Email", userShipment.UserID);
     return(View(userShipment));
 }
Beispiel #3
0
        // GET: AdminUserShipments/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UserShipment userShipment = db.UserShipments.Find(id);

            if (userShipment == null)
            {
                return(HttpNotFound());
            }
            return(View(userShipment));
        }
        public ActionResult Create([Bind(Include = "UserShipId,UserID,Invoice,Name,Surname,Country,City,ZipCode,Street,NumberHouse,NumberFlat,Telephone,AdditionalInfo")] UserShipment userShipment)
        {
            if (ModelState.IsValid)
            {
                var us = userShipment;
                us.UserID = User.Identity.GetUserId();
                db.UserShipments.Add(us);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.UserID = new SelectList(db.Users.Where(t => t.Id == User.Identity.GetUserId()), "Id", "Email", userShipment.UserID);
            return(View(userShipment));
        }
Beispiel #5
0
        // GET: AdminUserShipments/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UserShipment userShipment = db.UserShipments.Find(id);

            if (userShipment == null)
            {
                return(HttpNotFound());
            }
            ViewBag.UserID = new SelectList(db.Users, "Id", "Email", userShipment.UserID);
            return(View(userShipment));
        }
        // GET: AdminUserShipments/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            string       userid       = User.Identity.GetUserId();
            UserShipment userShipment = db.UserShipments.Include(t => t.User).SingleOrDefault(t => t.UserShipId == id);

            if (userShipment == null || userShipment.UserID != userid)
            {
                return(HttpNotFound());
            }
            return(View(userShipment));
        }
        // GET: AdminUserShipments/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UserShipment userShipment = db.UserShipments.Find(id);
            string       userid       = User.Identity.GetUserId();

            if (userShipment == null || userShipment.UserID != userid)
            {
                return(HttpNotFound());
            }
            return(View(userShipment));
        }