public ActionResult Create([Bind(Include = "pro_id,pro_name,pro_status")] projecttbl projecttbl) { if (ModelState.IsValid) { db.projecttbls.Add(projecttbl); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(projecttbl)); }
public ActionResult Create([Bind(Include = "dep_id,dep_name")] departmenttbl departmenttbl) { if (ModelState.IsValid) { db.departmenttbls.Add(departmenttbl); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(departmenttbl)); }
public ActionResult Create([Bind(Include = "q_id,question")] questiontbl questiontbl) { if (ModelState.IsValid) { db.questiontbls.Add(questiontbl); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(questiontbl)); }
public ActionResult Create([Bind(Include = "user_id,user_name,user_mail,user_Pass,Dep_id")] UserTbl userTbl) { if (ModelState.IsValid) { db.UserTbls.Add(userTbl); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Dep_id = new SelectList(db.departmenttbls, "dep_id", "dep_name", userTbl.Dep_id); return(View(userTbl)); }
public ActionResult Create([Bind(Include = "team_id,dep_id,pro_id,user_id,role_id")] teamtbl teamtbl) { if (ModelState.IsValid) { db.teamtbls.Add(teamtbl); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.pro_id = new SelectList(db.projecttbls, "pro_id", "pro_name", teamtbl.pro_id); ViewBag.role_id = new SelectList(db.roletbls, "role_id", "role_name", teamtbl.role_id); ViewBag.user_id = new SelectList(db.UserTbls, "user_id", "user_name", teamtbl.user_id); ViewBag.dep_id = new SelectList(db.departmenttbls, "dep_id", "dep_name", teamtbl.dep_id); return(View(teamtbl)); }
public ActionResult Index(FormCollection form) { //int va = valueid; using (HapinessSurveyEntities entities = new HapinessSurveyEntities()) { string[] questions = Request.Form.GetValues("questionid"); int userid = Convert.ToInt32(Session["isuserId"]); int roleno = Convert.ToInt32(Session["RoleID"]); //List<Submitsurvey> submitsurveys = new List<Submitsurvey>(); foreach (var question in questions) { String rat = Request.Form.Get("rank+" + question); String comment = Request.Form.Get("comment+" + question); String surveryid = Request.Form.Get("surveryid+" + question); Submitsurvey submitsurvey = new Submitsurvey(); submitsurvey.rating = Convert.ToInt32(rat); submitsurvey.comment = comment; submitsurvey.sur_id = Convert.ToInt32(surveryid); submitsurvey.u_id = userid; submitsurvey.role_id = roleno; submitsurvey.sq_id = Convert.ToInt32(question); entities.Submitsurveys.Add(submitsurvey); entities.SaveChanges(); } } // string[] value = Request.Form.GetValues("Country"); return(RedirectToAction("Index", "Rating")); }
public ActionResult Edit(Questionmodel questionmodel) { try { using (HapinessSurveyEntities entities = new HapinessSurveyEntities()) { var modiques = entities.questiontbls.Where(a => a.q_id.Equals(questionmodel.q_id)).First(); // questionmodel.q_id = modiques.q_id; // List < Questionmodel > qlist = new List<Questionmodel>(); modiques.question = questionmodel.questions; entities.SaveChanges(); return(View("question")); } } catch (Exception) { throw; } //eturn View("Edit", questionmodel); }
public ActionResult Create(Questionmodel questionmodel) { try { using (HapinessSurveyEntities entities = new HapinessSurveyEntities()) { //var addques = entities.questiontbls.Where(a => a.q_id.Equals(questionmodel.q_id)).First(); questiontbl ques = new questiontbl(); // List < Questionmodel > qlist = new List<Questionmodel>(); ques.question = questionmodel.questions; entities.questiontbls.Add(ques); entities.SaveChanges(); return(View("question")); } } catch (Exception) { throw; } // return View("Edit"); }
public JsonResult delete(int?id) { try { using (HapinessSurveyEntities entities = new HapinessSurveyEntities()) { if (id == null) { return(Json(new { data = "Not Deleted" }, JsonRequestBehavior.AllowGet)); } var deleteques = entities.questiontbls.Find(id); entities.questiontbls.Remove(deleteques); entities.SaveChanges(); return(Json(new { data = "Delete" }, JsonRequestBehavior.AllowGet)); } } catch (Exception) { throw; } }
public ActionResult Index(List <SelectListItem> items, FormCollection form) { // string ddldep =Request.Form["Departmentddl"].ToString(); string ddlproj = Request.Form["Projectddl"].ToString(); string ddlrole = Request.Form["Roleddl"].ToString(); using (HapinessSurveyEntities entities = new HapinessSurveyEntities()) { int id, ids; var surveyCre = new surveytbl(); { surveyCre.role_id = Convert.ToInt32(ddlrole); surveyCre.Start_date = DateTime.Today; surveyCre.End_date = DateTime.Today.Date.AddDays(3); surveyCre.proj_id = Convert.ToInt32(ddlproj); surveyCre.Dep_id = 0; entities.surveytbls.Add(surveyCre); entities.SaveChanges(); ids = surveyCre.sur_id; entities.SaveChanges(); } // ViewBag.Message = "Selected Items:\\n"; foreach (SelectListItem item in items) { if (item.Selected) { try { //surveyCre.role_id = 1; //surveyCre.Start_date = DateTime.Today.Date; //surveyCre.End_date = DateTime.Today.Date.AddDays(3); //surveyCre.proj_id = 1; //surveyCre.Dep_id = 1; //entities.surveytbls.Add(surveyCre); //entities.SaveChanges(); //ids = surveyCre.sur_id; if (ids != 0) { surveyquestion surveyq = new surveyquestion(); { // var surcreid = (from q in entities.surveytbls select q.sur_id).FirstOrDefault(); surveyq.sur_id = ids; surveyq.q_id = Convert.ToInt32(item.Value); entities.surveyquestions.Add(surveyq); entities.SaveChanges(); // id = surveyq.sq_id; } } } catch (Exception ex) { } // ViewBag.Message += string.Format("{0}\\n", item.Text); } else { ViewBag.Message = "Select Question"; } } int pid = Convert.ToInt32(ddlproj); int rid = Convert.ToInt32(ddlrole); if (rid != 0) { var listusers = (from t in entities.teamtbls where t.pro_id == pid && t.role_id == rid select new { t.user_id }).ToList(); userSurvey surveyusers = new userSurvey(); foreach (var l in listusers) { surveyusers.user_id = l.user_id; surveyusers.sur_id = ids; surveyusers.Active = true; entities.userSurveys.Add(surveyusers); entities.SaveChanges(); } } else { var listusers = (from t in entities.teamtbls where t.pro_id == pid select new { t.user_id }).ToList(); userSurvey surveyusers = new userSurvey(); foreach (var l in listusers) { surveyusers.user_id = l.user_id; surveyusers.sur_id = ids; surveyusers.Active = true; entities.userSurveys.Add(surveyusers); entities.SaveChanges(); } } } return(RedirectToAction("Dashboard", "Home")); }