public ActionResult Index(string blogTitle, string editor1, HttpPostedFileBase file) { var path = ""; var photoPath = ""; if (file != null) { if (file.ContentLength > 0) { if (Path.GetExtension(file.FileName).ToLower() == ".jpg" || Path.GetExtension(file.FileName).ToLower() == ".png" || Path.GetExtension(file.FileName).ToLower() == ".gif" || Path.GetExtension(file.FileName).ToLower() == ".jpeg") { path = Path.Combine(Server.MapPath("Images"), file.FileName); file.SaveAs(path); //photoPath = "~/Images/" + file.FileName; photoPath = file.FileName; } } } editor1 = editor1.Replace("”", " "); editor1 = editor1.Replace("“", " "); editor1 = editor1.Replace("”", " "); editor1 = editor1.Replace("<br>", " "); editor1 = editor1.Replace("<br />", " "); editor1 = editor1.Replace(" ", " "); editor1 = editor1.Replace("&hellip", " "); editor1 = editor1.Replace("–", " "); editor1 = editor1.Replace(" ", " "); editor1 = editor1.Replace("‌", " "); editor1 = editor1.Replace("’", " "); editor1 = editor1.Replace(""", " "); editor1 = editor1.Replace("<p>", " "); editor1 = editor1.Replace("</p>", " "); Post post = new Post(); post.Title = blogTitle; post.UserName = Session["userNick"].ToString(); post.DateTime = System.DateTime.Now.ToString(); post.Body = editor1; post.Image = photoPath; string stringID = Session["userId"].ToString(); int intId = Convert.ToInt32(stringID); post.UserId = stringID; db.Posts.Add(post); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Register([Bind(Include = "studentId,fullName,nickName,Dob,Faculty,Registration,Session,Hall,Father,Mother,Phone,Email,Password,parmanentAddress,Photo")] Student student) { if (ModelState.IsValid) { db.Students.Add(student); db.SaveChanges(); return(RedirectToAction("Index", "Blog")); } return(View(student)); }
public ActionResult RemoveReq(string id, string semester) { var query = (from s in db.HallFees where (s.studentId == id) && (s.payForSemester == semester) select s); foreach (var item in query) { db.HallFees.Remove(item); db.SaveChanges(); } db.SaveChanges(); return(RedirectToAction("HallFeeInfoList", "HallOfficer")); }
public ActionResult Approve([Bind(Include = "studentId, dateTime, payForSemester, receiptId, amount, status")] SemesterFee semesterFee) { if (ModelState.IsValid) { var model = (from p in db.SemesterFees where (p.studentId == semesterFee.studentId) && (p.payForSemester == semesterFee.payForSemester) select p).FirstOrDefault(); model.status = "Approved!!!"; db.Entry(model).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("SemInfoList")); } return(View(semesterFee)); }
public ActionResult HallSubmitInfo(string receiptId, string payForSemester, float amount) { string userId = Session["userId"].ToString(); string userFaculty = Session["userFaculty"].ToString(); var hallFeeCheck = (from s in db.HallFees where (s.studentId == userId) && (s.payForSemester == payForSemester) select s).FirstOrDefault(); if (hallFeeCheck == null) { HallFee hallFee = new HallFee(); hallFee.studentId = userId; hallFee.faculty = userFaculty; // hallFee.payForSemester = payForSemester; hallFee.receiptId = receiptId; hallFee.amount = amount; hallFee.dateTime = System.DateTime.Now.ToString(); hallFee.status = "In Processing ..."; db.HallFees.Add(hallFee); db.SaveChanges(); } else { // ViewBag.availablity = "Information For This Semeser Is In Processing ... "; return(RedirectToAction("AvailablityResult", "HallFee")); } return(RedirectToAction("HallSubmitInfo", "HallFee")); }
public ActionResult addToDatabase(string receiptId, string payForSemester, float amount) { string errorMessage = null; string courseTitle = null; string courseCode = null; string userId = Session["userId"].ToString(); string userFaculty = Session["userFaculty"].ToString(); foreach (FiEnrollment item in (List <FiEnrollment>)Session["cart"]) { courseTitle += item.Courses.courseTitle + ","; courseCode += item.Courses.courseCode + ","; } FiSemesterFee detail = new FiSemesterFee(); detail.studentId = userId; detail.payForSemester = payForSemester; detail.receiptId = receiptId; detail.amount = amount; detail.faculty = userFaculty; detail.dateTime = System.DateTime.Now.ToString(); detail.CourseCode = courseCode; detail.CourseTitle = courseTitle; detail.status = "In Processing ..."; // "In Processing ..."; try { db.FiSemesterFees.Add(detail); db.SaveChanges(); } catch (DbEntityValidationException ee) { foreach (var error in ee.EntityValidationErrors) { foreach (var thisError in error.ValidationErrors) { errorMessage = thisError.ErrorMessage; } } } Session["cart"] = null; Session["tch"] = null; Session["tam"] = null; // return Content(errorMessage); return(RedirectToAction("CheckStatus", "SemesterFee")); }
public ActionResult chat(string userName, string message) { chat ct = new chat(); ct.userName = Session["userNick"].ToString(); ct.selectionCode = Session["userId"].ToString(); ct.message = message; ct.timeDate = DateTime.Now.ToString(); db.chats.Add(ct); db.SaveChanges(); return(View()); }
public ActionResult EnrollmentStatus([Bind(Include = "status,faculty")] enrollmentStatu enrollmentStatus) { if (ModelState.IsValid) { var model = (from p in db.enrollmentStatus where (p.faculty == enrollmentStatus.faculty) select p).FirstOrDefault(); model.status = enrollmentStatus.status; db.Entry(model).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("EnrollmentStatus", "DeanOffice")); } return(View()); }
public ActionResult SubmitInfo(string receiptId, string payForSemester, float amount) { string userId = Session["userId"].ToString(); string userFaculty = Session["userFaculty"].ToString(); SemesterFee semesterFee = new SemesterFee(); semesterFee.studentId = userId; semesterFee.faculty = userFaculty; // semesterFee.payForSemester = payForSemester; semesterFee.receiptId = receiptId; semesterFee.amount = amount; semesterFee.dateTime = System.DateTime.Now.ToString(); semesterFee.hallClearance = "In Processing ..."; semesterFee.status = "In Processing ..."; db.SemesterFees.Add(semesterFee); db.SaveChanges(); return(RedirectToAction("SubmitInfo")); }