Exemplo n.º 1
0
        public PartialViewResult NewAssignTrainer(TrainerCreateForPV trainerCV)
        {
            var courseAss = new CourseAssing();

            if (_courseAssingBll.GetAll().Any(e => e.TrainerId == trainerCV.Id))
            {
                ModelState.AddModelError("Id", "Trainer is Already Assign");
            }
            else
            {
                //if (ModelState.IsValid)
                //{
                int CourseId = cId;


                courseAss.CourseId    = CourseId;
                courseAss.TrainerId   = trainerCV.Id;
                courseAss.LeadTrainer = trainerCV.Lead;
                bool isAdded = _courseAssingBll.Add(courseAss);
                if (isAdded)
                {
                    ViewBag.SuMsg = "Saved";
                }
                else
                {
                    ViewBag.ErMsg = "Failed";
                }
            }
            //List<CourseAssing> courseAssingsList = _courseAssingBll.GetAll();
            //trainerCV.TrainerCourseAssList = courseAssingsList.Select(x => new TrinerCourseAssing() { Id = x.Id, TrainerId = x.TrainerId,LeadTrainer = x.LeadTrainer,TrinerName = x.Trainer.Name });
            trainerCV.TrainerSelList = _trainerBll.GetAll()
                                       .Select(c => new SelectListItem()
            {
                Value = c.Id.ToString(),
                Text  = c.Name
            }).ToList();


            ViewBag.Id = new SelectList(new List <Organization>(), "Id", "Name");

            return(PartialView("~/Views/Shared/Course/_AssignTrainer.cshtml", trainerCV));
        }
        public CourseAssing GetById(int id)
        {
            CourseAssing courseAssing = _courseAssRepository.GetById(id);

            return(courseAssing);
        }
        public bool Remove(CourseAssing courseAss)
        {
            bool isDelete = _courseAssRepository.Remove(courseAss);

            return(isDelete);
        }
        public bool Update(CourseAssing courseAss)
        {
            bool isSaved = _courseAssRepository.Update(courseAss);

            return(isSaved);
        }
        public bool Add(CourseAssing courseAss)
        {
            bool IsSave = _courseAssRepository.Add(courseAss);

            return(IsSave);
        }
Exemplo n.º 6
0
 public bool Remove(CourseAssing courseAss)
 {
     db.CourseAssingss.Remove(courseAss);
     return(db.SaveChanges() > 0);
 }
Exemplo n.º 7
0
        public bool Update(CourseAssing courseAss)
        {
            db.Entry(courseAss).State = EntityState.Modified;

            return(db.SaveChanges() > 0);
        }
Exemplo n.º 8
0
 public bool Add(CourseAssing courseAss)
 {
     db.CourseAssingss.Add(courseAss);
     return(db.SaveChanges() > 0);
 }