public ActionResult DeleteInvoice(int id) { Invoice invoiceToDelete = _db.Invoices.Find(id); _db.Invoices.Remove(invoiceToDelete); _db.SaveChanges(); return(RedirectToAction("Invoices")); }
public ActionResult Create([Bind(Exclude = "Id")] Allocation AllocationToCreate) { if (!ModelState.IsValid) { return(View()); } _db.Allocations.Add(AllocationToCreate); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Exclude = "Id")] classroom classroomToCreate) { if (!ModelState.IsValid) { return(View()); } _db.classrooms.Add(classroomToCreate); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Exclude = "Id")] Tutes tuteToCreate) { if (!ModelState.IsValid) { return(View()); } _db.Tutes1.Add(tuteToCreate); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Exclude = "id")] marksInfo marksToCreate) { if (!ModelState.IsValid) { return(View()); } _db.marksInfoes.Add(marksToCreate); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Exclude = "id")] Student studentToCreate) { if (!ModelState.IsValid) { return(View()); } _db.Students.Add(studentToCreate); _db.SaveChanges(); return(RedirectToAction("StudentView")); }
public ActionResult Create([Bind(Exclude = "id")] exam examsToCreate) { if (!ModelState.IsValid) { return(View()); } _db.exams.Add(examsToCreate); _db.SaveChanges(); return(RedirectToAction("Exams")); }
public ActionResult Save(repair com) { bool status = false; if (ModelState.IsValid) { using (TCMSDBEntities dc = new TCMSDBEntities()) { if (com.MachineNO > 0) { // Edit var v = dc.repairs.Where(a => a.repair_id == com.repair_id).FirstOrDefault(); if (v != null) { v.MachineNO = com.MachineNO; v.cost = com.cost; v.description = com.description; v.repair_date = com.repair_date; } else { //Save dc.repairs.Add(com); } dc.SaveChanges(); status = true; } } } return(new JsonResult { Data = new { status = status, message = "Saved Successfully" } }); //return Json(new { status = true, message = "Saved Successfully" }, JsonRequestBehavior.AllowGet); }
public ActionResult Save(lab com) { bool status = false; if (ModelState.IsValid) { using (TCMSDBEntities dc = new TCMSDBEntities()) { if (com.LabNo > 0) { // Edit var v = dc.labs.Where(a => a.LabNo == com.LabNo).FirstOrDefault(); if (v != null) { v.LabNo = com.LabNo; v.floor = com.floor; } else { //Save dc.labs.Add(com); } } dc.SaveChanges(); status = true; } } return(new JsonResult { Data = new { status = status, message = "Saved Successfully" } }); }
public ActionResult Create([Bind(Exclude = "sub_id")] subject subjectToCreate) { try { if (!ModelState.IsValid) return View(); _db.subjects.Add(subjectToCreate); _db.SaveChanges(); return RedirectToAction("SubjectView"); } catch { return View(); } }
public ActionResult Create([Bind(Exclude = "emp_id")] notify notifyToCreate) { try { if (!ModelState.IsValid) { return(View()); } _db.notifies.Add(notifyToCreate); _db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create([Bind(Exclude = "id")] teacher teacherToCreate) { if (!ModelState.IsValid) { return(View()); } _db.teachers.Add(teacherToCreate); try { _db.SaveChanges(); } catch { Console.WriteLine(); } return(RedirectToAction("TeacherView")); }
public ActionResult Create([Bind(Exclude = "emp_id")] employee employeeToCreate) { try { if (!ModelState.IsValid) { return(View()); } _db.employees.Add(employeeToCreate); _db.SaveChanges(); return(RedirectToAction("EmployeeView")); } catch { return(View()); } }
public ActionResult Save(computer com) { bool status = false; if (ModelState.IsValid) { using (TCMSDBEntities dc = new TCMSDBEntities()) { if (com.MachineNO > 0) { // Edit var v = dc.computers.Where(a => a.MachineNO == com.MachineNO).FirstOrDefault(); if (v != null) { v.MachineNO = com.MachineNO; v.Processor_Type = com.Processor_Type; v.HDD_Capacity = com.HDD_Capacity; v.RAM_Capacity = com.RAM_Capacity; v.PowerSupply_ID = com.PowerSupply_ID; v.Motherboard_ID = com.Motherboard_ID; v.LabNo = com.LabNo; } else { //Save dc.computers.Add(com); } } try { dc.SaveChanges(); status = true; } catch (Exception) { status = true; return(new JsonResult { Data = new { status = status, message = "Something Wrong!" } }); throw; } } } return(new JsonResult { Data = new { status = status, message = "Saved Successfully" } }); //return Json(new { status = true, message = "Saved Successfully" }, JsonRequestBehavior.AllowGet); }
public ActionResult DeleteMachine(int id) { bool status = false; using (TCMSDBEntities dc = new TCMSDBEntities()) { var v = dc.repairs.Where(a => a.repair_id == id).FirstOrDefault(); if (v != null) { dc.repairs.Remove(v); dc.SaveChanges(); status = true; } } return(new JsonResult { Data = new { status = status, message = "Repair Details Deleted Successfully" } }); }
public ActionResult Create([Bind(Exclude = "att_id")] student_attendence studentToAttend) { try { if (!ModelState.IsValid) { return(View()); } _db.student_attendence.Add(studentToAttend); _db.SaveChanges(); return(RedirectToAction("Attendance")); } catch { return(View()); } }
public ActionResult Create([Bind(Exclude = "att_id")] emp_attendence employeeToAttend) { try { if (!ModelState.IsValid) { return(View()); } _db.emp_attendence.Add(employeeToAttend); _db.SaveChanges(); return(RedirectToAction("Index")); //return View(); } catch { return(View()); } }