public ActionResult Create(Participant participant)
        {
            if (ModelState.IsValid)
            {
                AddImages(participant);
                db.Participants.Add(participant);
                bool IsSaved = db.SaveChanges() > 0;
                if (IsSaved)
                {
                    ViewBag.Message = "Participant Saved Successfully";
                }
                else
                {
                    ViewBag.Message = "Participant Saved Failed";
                }
                //return RedirectToAction("Index");
            }

            var defaultSelectListItems = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Value = "", Text = "...Select..."
                }
            };

            ViewBag.OrganizationId = new SelectList(db.Organizations, "Id", "Org_Name");
            ViewBag.CourseId       = defaultSelectListItems;
            ViewBag.BatchId        = defaultSelectListItems;

            return(View(participant));
        }
        public ActionResult Create([Bind(Include = "Id,ExamType,ExamCode,Topic,FullMarks,Duration,CourseId")] Exam exam)
        {
            if (ModelState.IsValid)
            {
                db.Exams.Add(exam);
                bool IsSaved = db.SaveChanges() > 0;
                if (IsSaved)
                {
                    ViewBag.Message = "Exam Created Successfully";
                }
                else
                {
                    ViewBag.Message = "Exam Save Failed";
                }
                //return RedirectToAction("Index");
            }

            var defaultSelectListItems = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Value = "", Text = "...Select..."
                }
            };

            ViewBag.OrganizationId = new SelectList(db.Organizations, "Id", "Org_Name");
            ViewBag.CourseId       = defaultSelectListItems;
            //ViewBag.BatchId = defaultSelectListItems;
            return(View(exam));
        }
Beispiel #3
0
        public ActionResult Create([Bind(Include = "Id,BatchNo,Description,StartDate,EndDate,CourseId")] Batch batch)
        {
            if (ModelState.IsValid)
            {
                db.Batches.Add(batch);
                bool IsSaved = db.SaveChanges() > 0;
                if (IsSaved)
                {
                    return(RedirectToAction("Edit", new { @id = batch.Id }));
                }
            }

            //ViewBag.CourseId = new SelectList(db.Courses, "Id", "Name", batch.CourseId);
            var defaultSelectListItems = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Value = "", Text = "...Select..."
                }
            };

            ViewBag.OrganizationId = new SelectList(db.Organizations, "Id", "Org_Name");
            ViewBag.CourseId       = defaultSelectListItems;
            return(View(batch));
        }
        public ActionResult Create(Organization organization)
        {
            if (ModelState.IsValid)
            {
                AddImages(organization);
                db.Organizations.Add(organization);
                db.SaveChanges();
                return(RedirectToAction("SearchOrganization"));
            }

            return(View(organization));
        }
        public ActionResult Create([Bind(Include = "CourseId,TrainerId")] CourseTrainer courseTrainer)
        {
            if (ModelState.IsValid)
            {
                db.CourseTrainers.Add(courseTrainer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CourseId  = new SelectList(db.Courses, "Id", "Name", courseTrainer.CourseId);
            ViewBag.TrainerId = new SelectList(db.Trainers, "Id", "Name", courseTrainer.TrainerId);
            return(View(courseTrainer));
        }
Beispiel #6
0
        public ActionResult Save(Organization organization)
        {
            bool status = false;

            if (ModelState.IsValid)
            {
                db.Organizations.Add(organization);
                db.SaveChanges();
                status = true;
            }


            return(Json(status));
        }
        public ActionResult Create([Bind(Include = "Id,Name,CourseCode,CourseDuration,Credit,CourseOutLine,OrganizationId")] Course course)
        {
            if (ModelState.IsValid)
            {
                db.Courses.Add(course);
                bool IsSaved = db.SaveChanges() > 0;
                if (IsSaved)
                {
                    return(RedirectToAction("Edit", new { @id = course.Id }));
                }
            }

            ViewBag.OrganizationId = new SelectList(db.Organizations, "Id", "Org_Name", course.OrganizationId);
            return(View(course));
        }
Beispiel #8
0
        public ActionResult Create(/*TrainerCreateVM*/ Trainer trainer)
        {
            if (ModelState.IsValid)
            {
                //CourseTrainer courseTrainer = new CourseTrainer();


                //var entity = Mapper.Map<Trainer>(trainer);
                //db.Trainers.Add(entity);
                //db.SaveChanges();
                AddImages(trainer);
                db.Trainers.Add(trainer);
                bool IsSaved = db.SaveChanges() > 0;
                if (IsSaved)
                {
                    ViewBag.Message = "Trainer Saved Successfully";
                }
                else
                {
                    ViewBag.Message = "Trainer Saved Failed";
                }
                //return RedirectToAction("Index");
            }

            ViewBag.OrganizationId = new SelectList(db.Organizations, "Id", "Org_Name", trainer.OrganizationId);
            //trainer.OrganizationLookUps = db.Organizations.Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.Org_Name }).ToList();
            //trainer.CourseLookUps = db.Courses.Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.Name }).ToList();
            var defaultSelectListItems = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Value = "", Text = "...Select..."
                }
            };

            ViewBag.CourseId = defaultSelectListItems;
            ViewBag.BatchId  = defaultSelectListItems;
            return(View(trainer));
        }
Beispiel #9
0
 public bool Add(Organization organization)
 {
     _dbCoctext.Organizations.Add(organization);
     return(_dbCoctext.SaveChanges() > 0);
 }
 public bool Add(Course course)
 {
     db.Courses.Add(course);
     return(db.SaveChanges() > 0);
 }
 public bool Add(T entity)
 {
     db.Set <T>().Add(entity);
     return(db.SaveChanges() > 0);
 }