예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            WriteCV writeCV = db.WriteCVs.Find(id);

            db.WriteCVs.Remove(writeCV);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "WritecvID,User_ID,PreviousWork,Email,Skills,Studies,Languages,Hobbies")] WriteCV writeCV)
 {
     if (ModelState.IsValid)
     {
         db.Entry(writeCV).State = EntityState.Modified;
         db.SaveChanges();
         //return RedirectToAction("Index");
         return(RedirectToAction("Details", "WriteCVs", new { id = writeCV.WritecvID }));
     }
     ViewBag.User_ID = new SelectList(db.Users, "User_ID", "FirstName", writeCV.User_ID);
     return(View(writeCV));
 }
예제 #3
0
        // GET: WriteCVs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WriteCV writeCV = db.WriteCVs.Find(id);

            if (writeCV == null)
            {
                return(HttpNotFound());
            }
            return(View(writeCV));
        }
예제 #4
0
        // GET: WriteCVs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WriteCV writeCV = db.WriteCVs.Find(id);

            if (writeCV == null)
            {
                return(HttpNotFound());
            }
            ViewBag.User_ID = new SelectList(db.Users, "User_ID", "FirstName", writeCV.User_ID);
            return(View(writeCV));
        }
        // GET: Users/Details/5
        public ActionResult Details(/*int? id,*/ string email)
        {
            if (email == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //User user = db.Users.Find(id);
            User user = db.Users.SingleOrDefault(d => d.Email == email);

            ViewBag.userID = user.User_ID;
            WriteCV wrcv = db.WriteCVs.SingleOrDefault(d => d.User_ID == user.User_ID);

            ViewBag.writecv = wrcv.WritecvID;
            if (user == null)
            {
                return(HttpNotFound());
            }
            return(View(user));
        }
예제 #6
0
        public ActionResult Create([Bind(Include = "WritecvID,User_ID,PreviousWork,Email,Skills,Studies,Languages,Hobbies")] WriteCV writeCV)
        {
            // User user = db.Users.Find(User.Identity.Name.TrimEnd());

            User user = db.Users.FirstOrDefault(s => s.Email == User.Identity.Name.TrimEnd());

            if (ModelState.IsValid)
            {
                writeCV.User_ID = user.User_ID;
                writeCV.Email   = User.Identity.Name.TrimEnd();

                db.WriteCVs.Add(writeCV);
                db.SaveChanges();
                //return RedirectToAction("Index");
                return(RedirectToAction("Details", "Users", new { email = User.Identity.Name.TrimEnd() }));
            }

            ViewBag.User_ID = new SelectList(db.Users, "User_ID", "FirstName", writeCV.User_ID);
            return(View(writeCV));
        }