public ActionResult DeleteConfirmed(int id) { CoreValueRecognitions coreValueRecognitions = db.CoreValueRecognitions.Find(id); db.CoreValueRecognitions.Remove(coreValueRecognitions); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,recognized,recognizor,award,recognizationDate,Comments")] CoreValueRecognitions coreValueRecognitions) { if (ModelState.IsValid) { db.Entry(coreValueRecognitions).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.recognized = new SelectList(db.Profiles, "ProfileId", "profileFirstName", coreValueRecognitions.recognized); ViewBag.recognizor = new SelectList(db.Profiles, "ProfileId", "profileFirstName", coreValueRecognitions.recognizor); return(View(coreValueRecognitions)); }
public ActionResult Create([Bind(Include = "ID,recognized,recognizor,award,recognizationDate,Comments")] CoreValueRecognitions coreValueRecognitions) { if (ModelState.IsValid) { db.CoreValueRecognitions.Add(coreValueRecognitions); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.recognized = new SelectList(db.Profiles, "ProfileId", "fullName", coreValueRecognitions.recognized); ViewBag.recognizor = new SelectList(db.Profiles, "ProfileId", "fullName", coreValueRecognitions.recognizor); return(View(coreValueRecognitions)); }
public ActionResult Create([Bind(Include = "ID,recognized,recognizor,award,recognizationDate,Comments")] CoreValueRecognitions coreValueRecognitions) { if (ModelState.IsValid) { Guid memberID; Guid.TryParse(User.Identity.GetUserId(), out memberID); coreValueRecognitions.recognizor = memberID; db.CoreValueRecognitions.Add(coreValueRecognitions); db.SaveChanges(); var recognizor = db.Profiles.Find(coreValueRecognitions.recognizor); var profile = db.Profiles.Find(coreValueRecognitions.recognized); var firstName = profile.profileFirstName; var lastName = profile.profileLastName; var fullNameRecognizor = recognizor.fullName; var email = profile.email; var msg = "Hi " + firstName + " " + lastName + ",\n\nWe wanted to notify you that your colleague, " + fullNameRecognizor + ", has recently given you a recognition."; msg += "\n\nTo access the recognition, please log into our system!"; msg += "\n\nSincerely\nTeam 8"; //notification += "<br/>" + firstName + " " + lastName + " at " + email; MailMessage myMessage = new MailMessage(); MailAddress from = new MailAddress("*****@*****.**", "SysAdmin"); myMessage.From = from; myMessage.To.Add(email); myMessage.Subject = "Recent recognition"; myMessage.Body = msg; try { SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "An7igua@2095"); smtp.EnableSsl = true; //smtp.Send(myMessage); TempData["mailError"] = msg; return(View("mailError")); } catch (Exception ex) { TempData["mailError"] = ex.Message; return(View("mailError")); } //return RedirectToAction("Index"); } ViewBag.recognized = new SelectList(db.Profiles, "ProfileId", "fullName", coreValueRecognitions.recognized); return(View(coreValueRecognitions)); }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CoreValueRecognitions coreValueRecognitions = db.CoreValueRecognitions.Find(id); if (coreValueRecognitions == null) { return(HttpNotFound()); } return(View(coreValueRecognitions)); }
// GET: CoreValueRecognitions/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CoreValueRecognitions coreValueRecognitions = db.CoreValueRecognitions.Find(id); if (coreValueRecognitions == null) { return(HttpNotFound()); } ViewBag.recognized = new SelectList(db.Profiles, "ProfileId", "fullName", coreValueRecognitions.recognized); ViewBag.recognizor = new SelectList(db.Profiles, "ProfileId", "fullName", coreValueRecognitions.recognizor); return(View(coreValueRecognitions)); }