public ActionResult feedBackServlet(Models.feedback u) { using (var context = new Shopping_DBEntities4()) { var student = new DB.feedback { email = u.email, message = u.message, }; context.feedbacks.Add(student); context.SaveChanges(); return(Content("<script>alert('Thanks for ur feedback!!');document.location='About'</script>")); } }
public ActionResult statuschange([Bind(Include = "Id,type,summary,description,filename,filepath,employee_name,emp_field,date_time,status")] Models.feedback feedbacks, int?id, string stat) { if (ModelState.IsValid) { var result = db.feedbacks.SingleOrDefault(b => b.Id == id); result.status = stat; db.SaveChanges(); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } feedback employee = db.feedbacks.Find(id); if (employee == null) { return(HttpNotFound()); } var mail = db.feedbacks .Where(x => x.Id == employee.Id) .Select(x => x.filename).Max(); var filepath = db.feedbacks .Where(x => x.Id == employee.Id) .Select(x => x.filepath).Max(); if (mail != null) { string path = Server.MapPath(filepath); byte[] imageByteData = System.IO.File.ReadAllBytes(path); string imageBase64Data = Convert.ToBase64String(imageByteData); string imageDataURL = string.Format("data:image/png;base64,{0}", imageBase64Data); ViewBag.ImageData = imageDataURL; } ViewBag.filecontent = mail; return(View(employee)); }
public ActionResult setFeedback(int projectid, int jd_id, String feedbackcontent, int rating) // in Home Page { // tl id get by session & pm_id will get from project_id -> userid-> pmtable -> pm id if (Session["type_id"].ToString() == "3") // tl { int tlid = Convert.ToInt32(Session["id"]); /* var tl_id = from d in db.TLs * where (d.user_id == tlid) * select d.TL_id;*/ int tl_id = db.TLs.Single(t => t.user_id == tlid).id; /* var pm_id = from d in db.projects * where (d.project_id == projectid) * select d.user_id;*/ int pm_id = db.projects.Single(t => t.id == projectid).user_id; /* var pmid = from d in db.PMS * where (d.user_id.Equals(pm_id)) * select d.PM_id;*/ int pmid = db.PMS.Single(t => t.user_id == pm_id).user_id; Models.feedback f = new Models.feedback() { rate = rating, content = feedbackcontent, JD_id = jd_id, TL_id = tl_id, PM_id = pmid, project_id = projectid, date = DateTime.Now }; db.feedbacks.Add(f); db.SaveChanges(); } return(View()); }