public async Task <ActionResult> Edit([Bind(Include = "CollegeID,CollegeName,CampusName,CollegeMailbox,PhoneNumber")] CollegeModel collegeModel) { if (ModelState.IsValid) { db.Entry(collegeModel).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.CampusName = new SelectList(db.Campuses, "CampusID", "CampusName", collegeModel.CampusName); return(View(collegeModel)); }
public async Task <ActionResult> Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CollegeModel collegeModel = await db.Colleges.FindAsync(id); if (collegeModel == null) { return(HttpNotFound()); } return(View(collegeModel)); }
public async Task <ActionResult> Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CollegeModel collegeModel = await db.Colleges.FindAsync(id); if (collegeModel == null) { return(HttpNotFound()); } ViewBag.CampusName = new SelectList(db.Campuses, "CampusID", "CampusName", collegeModel.CampusName); return(View(collegeModel)); }
public void TestWelcomMessage(string collageName) { //Arrange var collegeModel = new CollegeModel() { Name = collageName, }; var cBus = new Business.CollegeBusiness(); //Act var rsltMessage = cBus.WelcomeMessage(collegeModel); //Assert Assert.Equal($"Dear student, welcome to {collegeModel.Name} College.", rsltMessage); }
public ActionResult Edit(CollegeModel model) { if (ModelState.IsValid) { if (model == null) { TempData["Message"] = "College is not found"; return(View("Index")); } //model.ModifiedBy = User.Identity.GetUserName(); _attmgr.Update(model.CollegeId, model); return(RedirectToAction("Index")); } return(View(model)); }
public void TestShowNumberOfTeacher(int numberOfTeacher, string collageName) { //Arrange var collegeModel = new CollegeModel() { NumberOfTeacher = numberOfTeacher, Name = collageName }; var cBus = new Business.CollegeBusiness(); //Act var rsltMessage = cBus.NumberOfTeacher(collegeModel); //Assert Assert.Equal($"{collegeModel.Name}College has Number of Teacher = {collegeModel.NumberOfTeacher}", rsltMessage); }
public void TestMaxReachedOfCapacity(int numberCapcityClass, string collageName) { //Arrange var collegeModel = new CollegeModel() { NumberOfClass = numberCapcityClass, Name = collageName }; var cBus = new Business.CollegeBusiness(); //Act var rsltMessage = cBus.MaxSizeReached(collegeModel); //Assert Assert.Equal($"{collegeModel.Name}College has reached the maximum size of capacity", rsltMessage); }
public JsonResult GetColleges(string value) { List <CollegeModel> list = new List <CollegeModel>(); var parameters = new SqlParameter[1]; parameters[0] = new SqlParameter("@key", value); //oldCollegeName.Trim() DataSet ds = SqlHelper.FillDataSet(ConfigurationManager.RdConnectionString, "Get_CollegesByKey", parameters); foreach (DataRow dr in ds.Tables[0].Rows) { CollegeModel cmodel = new CollegeModel(); cmodel.CollegeName = dr["CollegeName"].ToString(); list.Add(cmodel); } return(Json(list, JsonRequestBehavior.AllowGet)); }
public ActionResult AddDepartment(CollegeModel collegeModel) { if (!ModelState.IsValid) { return(View()); } DepartmentService departmentService = new DepartmentService(); if (departmentService.InsertDepartment(collegeModel)) { TempData["toast"] = "Department Data Inserted Successfully"; //ViewBag.result = "Record Inserted Successfully!"; return(RedirectToAction("GetDepartment")); } else { ModelState.AddModelError("AddDepartmentFailedError", "Error in adding the Department. The Department code should be unique"); return(this.View()); } }
public bool DeleteDepartment(Guid ID) { try { tblDepartment entityToDelete = new tblDepartment(); entityToDelete = _unitOfWork.DepartmentRepository.GetByID(ID); //_unitOfWork.DepartmentRepository.Delete(ID); entityToDelete.IsDeleted = true; _unitOfWork.DepartmentRepository.Update(entityToDelete); _unitOfWork.Save(); return(true); } catch (Exception e) { string currentFile = new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); ErrorLogger.LogException(e, currentFile); CollegeModel college = new CollegeModel(); return(false); } }
public CollegeModel GetDepartment(Guid id) { try { CollegeModel collegeModel = new CollegeModel(); tblDepartment entity = new tblDepartment(); entity = _unitOfWork.DepartmentRepository.GetByID(id); collegeModel.DepartmentID = entity.DepartmentID; collegeModel.CollegeID = entity.CollegeId; collegeModel.DepartmentCode = entity.DepartmentCode; collegeModel.DepartmentName = entity.DepartmentName; collegeModel.TotalSem = entity.TotalSem; return(collegeModel); } catch (Exception e) { string currentFile = new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); ErrorLogger.LogException(e, currentFile); CollegeModel collegeModel = new CollegeModel(); return(collegeModel); } }
public ActionResult EditDepartment(CollegeModel collegeModel) { if (!ModelState.IsValid) { return(View()); } DepartmentService departmentService = new DepartmentService(); if (departmentService.EditDepartment(collegeModel)) { TempData["toast"] = "Department Data Updated Successfully"; return(RedirectToAction("GetAllDepartment", "Department", collegeModel)); } else { ModelState.AddModelError("UpdateDepartmentFailedError", "Error in updating the college. The Department code should be unique characters"); return(this.View()); } //DepartmentService departmentService = new DepartmentService(); //departmentService.EditDepartment(collegeModel); //return RedirectToAction("GetDepartment"); }
public bool EditDepartment(CollegeModel collegeModel) { try { tblDepartment entityToUpdate = new tblDepartment() { DepartmentID = collegeModel.DepartmentID, CollegeId = collegeModel.CollegeID, DepartmentCode = collegeModel.DepartmentCode, DepartmentName = collegeModel.DepartmentName, TotalSem = collegeModel.TotalSem }; _unitOfWork.DepartmentRepository.Update(entityToUpdate); _unitOfWork.Save(); return(true); } catch (Exception e) { string currentFile = new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); ErrorLogger.LogException(e, currentFile); CollegeModel college = new CollegeModel(); return(false); } }
public ActionResult Create(CollegeModel model) { bool flag = false; return(Json(flag, JsonRequestBehavior.AllowGet)); }
public void Add(CollegeModel model) { var entity = model.Create(model); _repo.Add <College>(entity); }
public void UpdateCollege(CollegeModel model) { throw new NotImplementedException(); }
public string NumberOfTeacher(CollegeModel collegeModel) { return($"{collegeModel.Name}College has Number of Teacher = {collegeModel.NumberOfTeacher}"); }
public IActionResult Create(CollegeModel college) { //data save logic return(RedirectToAction(nameof(Create))); }
#pragma warning disable 1998 public async Task <bool> UpdateCollegeAsync(CollegeModel college, CancellationToken ct = default) #pragma warning restore 1998 { throw new System.NotImplementedException(); }
public CollegeListPage() { InitializeComponent(); Cm = new CollegeModel(); CollegeList.ItemsSource = Cm.CollegeMods; }
public Task <CollegeModel> AddAsync(CollegeModel newCollege, CancellationToken ct = default) { throw new System.NotImplementedException(); }
public string WelcomeMessage(CollegeModel collegeModel) { return($"Dear student, welcome to {collegeModel.Name} College."); }
public Task <bool> UpdateAsync(CollegeModel college, CancellationToken ct = default) { throw new System.NotImplementedException(); }