// GET: NewReccomendations/Edit/5 public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Reccomendation reccomendation = db.Recomendation.Find(id); if (reccomendation == null) { return(HttpNotFound()); } // ViewBag.employeeId = new SelectList(db.profile, "profileID", "fullName", reccomendation.employeeId); ViewBag.recognitionId = new SelectList(db.profile, "profileID", "fullName", reccomendation.recognitionId); ViewBag.recognizerId = new SelectList(db.profile, "profileID", "fullName", reccomendation.recognizerId); return(View(reccomendation)); }
public ActionResult Create([Bind(Include = "ReccomendationId,recognizerId,recognitionId,award,awardDate,description")] Reccomendation reccomendation) { if (ModelState.IsValid) { Guid profileID; Guid.TryParse(User.Identity.GetUserId(), out profileID); reccomendation.recognizerId = profileID; reccomendation.awardDate = DateTime.Now; db.Recomendation.Add(reccomendation); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.recognitionId = new SelectList(db.profile, "profileID", "fullName", reccomendation.recognitionId); ViewBag.recognizerId = new SelectList(db.profile, "profileID", "fullName", reccomendation.recognizerId); return(View(reccomendation)); }
public IActionResult CreateRec(Reccomendation reccomend) { _context.Reccomendations.Add(reccomend); _context.SaveChanges(); return(RedirectToAction(nameof(Index))); }