Пример #1
0
        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));
        }
Пример #2
0
        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));
        }
Пример #3
0
        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));
        }
Пример #4
0
        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);
        }
Пример #5
0
 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));
 }
Пример #6
0
        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);
        }
Пример #7
0
        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);
        }
Пример #8
0
        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);
     }
 }
Пример #14
0
        public ActionResult Create(CollegeModel model)
        {
            bool flag = false;

            return(Json(flag, JsonRequestBehavior.AllowGet));
        }
Пример #15
0
        public void Add(CollegeModel model)
        {
            var entity = model.Create(model);

            _repo.Add <College>(entity);
        }
Пример #16
0
 public void UpdateCollege(CollegeModel model)
 {
     throw new NotImplementedException();
 }
Пример #17
0
 public string NumberOfTeacher(CollegeModel collegeModel)
 {
     return($"{collegeModel.Name}College has Number of Teacher =  {collegeModel.NumberOfTeacher}");
 }
Пример #18
0
        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();
        }
Пример #20
0
 public CollegeListPage()
 {
     InitializeComponent();
     Cm = new CollegeModel();
     CollegeList.ItemsSource = Cm.CollegeMods;
 }
Пример #21
0
 public Task <CollegeModel> AddAsync(CollegeModel newCollege, CancellationToken ct = default)
 {
     throw new System.NotImplementedException();
 }
Пример #22
0
 public string WelcomeMessage(CollegeModel collegeModel)
 {
     return($"Dear student, welcome to {collegeModel.Name} College.");
 }
Пример #23
0
 public Task <bool> UpdateAsync(CollegeModel college, CancellationToken ct = default)
 {
     throw new System.NotImplementedException();
 }