public IHttpActionResult PutEmployerQuestion(int id, EmployerQuestion employerQuestion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != employerQuestion.Id) { return(BadRequest()); } db.Entry(employerQuestion).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EmployerQuestionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult UserDashBoard([Bind(Include = "objTweet,objTweetList,objFollow")] TweetViewModel objTwt) { AssessmentEntities db = new AssessmentEntities(); tweet objTweet = new tweet(); following objFollow = new following(); TweetViewModel oTwt = new TweetViewModel(); if (ModelState.IsValid) { objTweet.user_id = Session["UserID"].ToString(); objTweet.created = DateTime.Now; objTweet.message = objTwt.objTweet.message; db.tweets.Add(objTweet); db.SaveChanges(); objFollow.user_id = Session["UserID"].ToString(); objFollow.following_id = objTwt.objFollow.following_id; db.followings.Add(objFollow); db.SaveChanges(); oTwt.objTweetList = GetTweetList(); oTwt.objTweet = new tweet(); oTwt.objTweet.message = string.Empty; oTwt.tweetCount = oTwt.objTweetList.Count.ToString(); string result = GetFollowingList(); oTwt.followingCount = result.Split(';')[0]; oTwt.followersCount = result.Split(';')[1]; return(View(oTwt)); } return(View(oTwt)); }
public ActionResult Create(RUBRICS_DATA rubricData) { if (ModelState.IsValid) { using (var context = new AssessmentEntities()) { try { context.RUBRICS_DATA.Add(rubricData); context.SaveChanges(); ViewBag.InsertionResult = "Rubric Successfully inserted."; } catch (Exception ex) { Response.Write(ex.Message); ViewBag.ErrorMsg = "Performance Indicator already Exist. Please check the input again"; return View("Error"); } finally { DepartmentList departmentList = new DepartmentList(); ViewBag.Departments = departmentList.getDepartmentList(context); } } return PartialView("_InsertResult"); } else { ViewBag.ErrorMsg = "Invalid Input entered."; return View("Error"); } }
public ActionResult SignUp([Bind(Include = "user_id,passwod,fullname,email")] person person) { AssessmentEntities db = new AssessmentEntities(); if (ModelState.IsValid) { person.active = true; person.joined = DateTime.Now; db.people.Add(person); db.SaveChanges(); return(RedirectToAction("Login")); } return(View(person)); }
// GET: Product_Details/Delete/5 public ActionResult Delete(int?id) { AssessmentEntities db = new AssessmentEntities(); tweet oTwt = db.tweets.Find(id); db.tweets.Remove(oTwt); db.SaveChanges(); TweetViewModel oTwts = new TweetViewModel(); oTwts.objTweetList = GetTweetList(); oTwts.objTweet = new tweet(); oTwts.objTweet.message = string.Empty; oTwts.tweetCount = oTwts.objTweetList.Count.ToString(); string result = GetFollowingList(); oTwts.followingCount = result.Split(';')[0]; oTwts.followersCount = result.Split(';')[1]; return(View("UserDashBoard", oTwts)); }
public ActionResult ChangePassword(ChangePassword changePassword) { if (ModelState.IsValid) { using (var context = new AssessmentEntities()) { var AdminRecord = context.spLOGIN(changePassword.UserName, changePassword.ExistingPassword).SingleOrDefault(); if (AdminRecord != null) { AdminRecord.ADMIN_PASSWORD = changePassword.NewPassword; context.SaveChanges(); ModelState.AddModelError("", "Password Changed Successfully"); } else { ModelState.AddModelError("", "Please enter correct password"); } } } return View(changePassword); }
public ActionResult Reference(ASSESSMENT_DATA assessedData) { bool status = false; using (var context = new AssessmentEntities()) { try { if (context.ASSESSMENT_DATA.Where(rdmstring => rdmstring.RANDOM_STRING == assessedData.RANDOM_STRING).ToList().Count != 0) { //link is already been used //delete old records context.spASSESSMENT_DELETE_OLD_RECORDS(assessedData.RANDOM_STRING); context.SaveChanges(); } foreach (var item in Session["RubRowIDS"] as List<String>) { string sessionData = Session[item].ToString(); String[] data = sessionData.Split('-'); assessedData.RUBRIC_ROWID = Int16.Parse(item); assessedData.POOR = Int16.Parse(data[0]); assessedData.DEVELOPING = Int16.Parse(data[1]); assessedData.DEVELOPED = Int16.Parse(data[2]); assessedData.EXEMPLARY = Int16.Parse(data[3]); if (assessedData.POOR + assessedData.DEVELOPING + assessedData.DEVELOPED + assessedData.EXEMPLARY != 0) { context.ASSESSMENT_DATA.Add(assessedData); context.SaveChanges(); context.spLINK_UPDATESTATUS(assessedData.RANDOM_STRING, false); context.SaveChanges(); } else { ViewBag.ErrorMsg = "Please input at least one record for assessment"; return View("Error"); } } return View("Success"); } catch (Exception ex) { Console.WriteLine(ex.Message); ViewBag.ErrorMsg = "Please complete all form fields."; return View("Error"); } } }
public void DeleteRubricRecord(int rubID) { using (var context = new AssessmentEntities()) { context.spRUBRIC_DELETE_RUBRICROW(rubID); context.SaveChanges(); } }
public ActionResult Send(FormCollection f) { using (var context = new AssessmentEntities()) { string department = Session["DEPARTMENT"].ToString(); string outcome = Session["Outcome"].ToString(); string instructorSelected = f["InstructorList"].ToString(); string urlParameters = "Dept=" + department + "&outcome=" + outcome + "&inst=" + instructorSelected; string rdm_string = RandomString(30); context.spLINK_INSERT(rdm_string, outcome, department, instructorSelected, true); context.SaveChanges(); string finalLink = link + rdm_string; SendMail sendmail = new SendMail(); if (sendmail.SendEmail(instructorSelected, "Assessment Form", sendmail.MailBody(finalLink))) { //mail sending currently commented out ViewBag.link = finalLink; return View("MailResult"); } else { ViewBag.ErrorMsg = "Unable to send the link to the Instructor. Please check the network connections or else try sending the link personally. Here it the link below \n" + "<h3>" + finalLink + "</h3>"; return View("Error"); } } }
public ActionResult SaveRubric(RUBRICS_DATA rubricData) { using (var context = new AssessmentEntities()) { context.spUPDATERUBRICDATA(rubricData.RUBRIC_ROWID, rubricData.OUTCOMES, rubricData.PERFORMANCE_INDICATOR, rubricData.TOPIC, rubricData.POOR, rubricData.DEVELOPING, rubricData.DEVELOPED, rubricData.EXEMPLARY, rubricData.EXPECTATION_LEVEL); context.SaveChanges(); var rubricRecord = context.spRUBRICSGETRECORD_RUBID(rubricData.RUBRIC_ROWID).SingleOrDefault(); return EditCancel(rubricData.RUBRIC_ROWID); } }