public ActionResult DeleteConfirmed(int id) { AspNetNote aspNetNote = db.AspNetNotes.Find(id); db.AspNetNotes.Remove(aspNetNote); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Title,Description,SubjectID,CourseType,Price,CreationDate")] AspNetNote aspNetNote) { if (ModelState.IsValid) { db.Entry(aspNetNote).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SubjectID = new SelectList(db.AspNetSubjects, "Id", "SubjectName", aspNetNote.SubjectID); return(View(aspNetNote)); }
public ActionResult Edit([Bind(Include = "Id,Title,Description,SubjectID,CourseType,Price,CreationDate,NotesType")] AspNetNote aspNetNote) { if (aspNetNote.NotesType == "Notes") { aspNetNote.NotesType = Request.Form["NotesType"]; aspNetNote.CourseType = Request.Form["CourseType"]; aspNetNote.Pages = Convert.ToDouble(Request.Form["Pages"]); aspNetNote.PerPagePrice = Convert.ToDouble(Request.Form["perPagePrice"]); aspNetNote.BindingPrice = Convert.ToDouble(Request.Form["bindingPrice"]); aspNetNote.GrandTotal = Convert.ToDouble(Request.Form["grandTotalHidden"]); aspNetNote.OAPrice = Convert.ToDouble(Request.Form["oAHidden"]); aspNetNote.PhotoCopierPrice = Convert.ToDouble(Request.Form["photoCopierHidden"]); aspNetNote.CreationDate = DateTime.Now; if (ModelState.IsValid) { db.Entry(aspNetNote).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } } else if (aspNetNote.NotesType == "Books") { aspNetNote.NotesType = Request.Form["NotesType"]; aspNetNote.OABookPercentage = Convert.ToDouble(Request.Form["OABookPercentage"]); aspNetNote.BindingPrice = Convert.ToDouble(Request.Form["bindingPrice"]); aspNetNote.OAPrice = Convert.ToDouble(Request.Form["oAHidden"]); aspNetNote.PhotoCopierPrice = Convert.ToDouble(Request.Form["photoCopierHidden"]); aspNetNote.GrandTotal = Convert.ToDouble(Request.Form["grandTotalHidden"]); aspNetNote.CourseType = Request.Form["CourseType"]; aspNetNote.CreationDate = DateTime.Now; if (ModelState.IsValid) { db.Entry(aspNetNote).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } } else { ModelState.AddModelError("NotesType", "Please Select Notes Type"); } ViewBag.SubjectID = new SelectList(db.AspNetSubjects, "Id", "SubjectName", aspNetNote.SubjectID); return(View(aspNetNote)); }
// GET: AspNetNotes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AspNetNote aspNetNote = db.AspNetNotes.Find(id); if (aspNetNote == null) { return(HttpNotFound()); } return(View(aspNetNote)); }
// GET: AspNetOrderNotes/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AspNetNote aspNetNote = db.AspNetNotes.Where(x => x.EncryptedID == id).FirstOrDefault(); if (aspNetNote == null) { return(HttpNotFound()); } return(View(aspNetNote)); }
// GET: AspNetNotes/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AspNetNote aspNetNote = db.AspNetNotes.Where(x => x.EncryptedID == id).FirstOrDefault(); if (aspNetNote == null) { return(HttpNotFound()); } ViewBag.SubjectID = new SelectList(db.AspNetSubjects, "Id", "SubjectName", aspNetNote.SubjectID); return(View(aspNetNote)); }
// GET: AspNetNotes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AspNetNote aspNetNote = db.AspNetNotes.Find(id); if (aspNetNote == null) { return(HttpNotFound()); } ViewBag.SubjectID = new SelectList(db.AspNetSubjects, "Id", "SubjectName", aspNetNote.SubjectID); return(View(aspNetNote)); }
public ActionResult Create([Bind(Include = "Id,Title,Description,SubjectID,CourseType,Price,CreationDate")] AspNetNote aspNetNote) { if (ModelState.IsValid) { // string EncrID = aspNetNote.Id + aspNetNote.SubjectID + aspNetNote.Price.ToString(); // aspNetNote.EncryptedID = Encrpt.Encrypt(EncrID, true); db.AspNetNotes.Add(aspNetNote); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SubjectID = new SelectList(db.AspNetSubjects, "Id", "SubjectName", aspNetNote.SubjectID); return(View(aspNetNote)); }
// GET: AspNetNotes/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AspNetNote aspNetNote = db.AspNetNotes.Where(x => x.EncryptedID == id).FirstOrDefault(); if (aspNetNote == null) { // return HttpNotFound(); var aspNetNotes = db.AspNetNotes.Include(a => a.AspNetSubject); return(View(aspNetNotes.ToList())); } return(View(aspNetNote)); }
public ActionResult Create([Bind(Include = "Id,Title,Description,SubjectID,CourseType,NotesType,Price,CreationDate,Pages,PerPagePrice,photoCopierHidden")] AspNetNote aspNetNote) { if (aspNetNote.NotesType == "Notes") { aspNetNote.NotesType = Request.Form["NotesType"]; aspNetNote.CourseType = Request.Form["CourseType"]; aspNetNote.Pages = Convert.ToDouble(Request.Form["Pages"]); aspNetNote.PerPagePrice = Convert.ToDouble(Request.Form["perPagePrice"]); aspNetNote.BindingPrice = Convert.ToDouble(Request.Form["bindingPrice"]); aspNetNote.GrandTotal = Convert.ToDouble(Request.Form["grandTotalHidden"]); aspNetNote.OAPrice = Convert.ToDouble(Request.Form["oAHidden"]); aspNetNote.PhotoCopierPrice = Convert.ToDouble(Request.Form["photoCopierHidden"]); aspNetNote.CreationDate = DateTime.Now; if (ModelState.IsValid) { string EncrID = aspNetNote.Id + aspNetNote.SubjectID + aspNetNote.Price.ToString(); aspNetNote.EncryptedID = Encrpt.Encrypt(EncrID, true); aspNetNote.EncryptedID.Replace('/', 's').Replace('-', 's').Replace('+', 's').Replace('%', 's').Replace('&', 's'); db.AspNetNotes.Add(aspNetNote); db.SaveChanges(); return(RedirectToAction("Index")); } } else if (aspNetNote.NotesType == "Books") { aspNetNote.NotesType = Request.Form["NotesType"]; aspNetNote.OABookPercentage = Convert.ToDouble(Request.Form["OABookPercentage"]); aspNetNote.BindingPrice = Convert.ToDouble(Request.Form["bindingPrice"]); aspNetNote.OAPrice = Convert.ToDouble(Request.Form["oAHidden"]); aspNetNote.PhotoCopierPrice = Convert.ToDouble(Request.Form["photoCopierHidden"]); aspNetNote.GrandTotal = Convert.ToDouble(Request.Form["grandTotalHidden"]); aspNetNote.CourseType = Request.Form["CourseType"]; string EncrID = aspNetNote.Id + aspNetNote.SubjectID + aspNetNote.Price.ToString(); aspNetNote.EncryptedID = Encrpt.Encrypt(EncrID, true); var newString = Regex.Replace(aspNetNote.EncryptedID, @"[^0-9a-zA-Z]+", "s"); // Lesson.EncryptedID.Replace('/', 's').Replace('-','s').Replace('+','s').Replace('%','s').Replace('&','s'); aspNetNote.EncryptedID = newString; // aspNetNote.EncryptedID.Replace('/', 's').Replace('-', 's').Replace('+', 's').Replace('%', 's').Replace('&', 's'); aspNetNote.CreationDate = DateTime.Now; if (ModelState.IsValid) { db.AspNetNotes.Add(aspNetNote); db.SaveChanges(); return(RedirectToAction("Index")); } } //else if else { ModelState.AddModelError("NotesType", "Please Select Notes Type"); } ViewBag.SubjectID = new SelectList(db.AspNetSubjects, "Id", "SubjectName", aspNetNote.SubjectID); return(View(aspNetNote)); }