// GET: /StudentModuleMapping/Details/5 public async Task <ActionResult> Details(int id) { StudentModuleMapping obj = await _logic.GetStudentModuleMapping(id); if (obj == null) { return(HttpNotFound()); } return(View(obj)); }
public async Task <bool> InsertUpdateStudentModuleMapping(StudentModuleMapping studentModuleMapping) { string query = "SpInsertUpdateStudentModuleMapping"; List <SqlParam> collection = new List <SqlParam>() { new SqlParam("@Id", SqlDbType.Int, studentModuleMapping.Id), new SqlParam("@StudentId", SqlDbType.Int, studentModuleMapping.StudentId), new SqlParam("@ModuleId", SqlDbType.Int, studentModuleMapping.ModuleId), }; return(await _dao.ExecuteNonQueryAsync(query, collection, CommandType.StoredProcedure)); }
// GET: /StudentModuleMapping/Edit/5 public async Task <ActionResult> Edit(int id) { StudentModuleMapping obj = await _logic.GetStudentModuleMapping(id); if (obj == null) { return(HttpNotFound()); } List <Module> lstModule = await _logicModule.GetModules(); List <Student> lstStudents = await _logicStudent.GetStudents(); ViewBag.ModuleId = new SelectList(lstModule, "Id", "Name", obj.ModuleId); ViewBag.StudentId = new SelectList(lstStudents, "Id", "Name", obj.StudentId); return(View(obj)); }
public async Task <ActionResult> Create([Bind(Include = "Id,StudentId,ModuleId")] StudentModuleMapping studentmodulemapping) { List <Module> lstModule = await _logicModule.GetModules(); List <Student> lstStudents = await _logicStudent.GetStudents(); ViewBag.ModuleId = new SelectList(lstModule, "Id", "Name"); ViewBag.StudentId = new SelectList(lstStudents, "Id", "Name"); bool status = false; string message = string.Empty; if (ModelState.IsValid) { try { status = await _logic.InsertUpdateStudentModuleMapping(studentmodulemapping); } catch (SqlException ex) { message = ex.Message; } catch (Exception) { message = "Unexpected error was found"; } } if (status) { return(RedirectToAction("Index")); } else { ViewBag.Message = message; return(View(studentmodulemapping)); } }
public async Task <bool> InsertUpdateStudentModuleMapping(StudentModuleMapping studentModuleMapping) { return(await _repo.InsertUpdateStudentModuleMapping(studentModuleMapping)); }