public ActionResult Entry()
        {
            var model = new ParticipantCreateVm()
            {
                OrganizationSelectListItems = GetAllOrganizationSlItems(),
                CourseSelectListItems       = GetAllCourseSlItems(),
                BatchSelectListItems        = GetAllBatchSlItems()
            };

            return(View(model));
        }
        public ActionResult Entry(ParticipantCreateVm entity)
        {
            HttpPostedFileBase file = Request.Files["uploadImage"];

            if (file != null)
            {
                entity.Image = ConvertToBytes(file);
                if (ModelState.IsValid)
                {
                    var participant  = Mapper.Map <Participant>(entity);
                    var participants = _participantManager.GetAllParticipants();
                    if (participants.FirstOrDefault(x => x.RegNo == participant.RegNo) != null)
                    {
                        ViewBag.Message = "Exist";
                        entity.OrganizationSelectListItems = GetAllOrganizationSlItems();
                        entity.CourseSelectListItems       = GetAllCourseSlItems();
                        entity.BatchSelectListItems        = GetAllBatchSlItems();
                        return(View(entity));
                    }
                    else
                    {
                        bool isAdded = _participantManager.Add(participant);

                        if (isAdded)
                        {
                            ModelState.Clear();
                            ViewBag.Message = "Saved";
                            var model = new ParticipantCreateVm()
                            {
                                OrganizationSelectListItems = GetAllOrganizationSlItems(),
                                CourseSelectListItems       = GetAllCourseSlItems(),
                                BatchSelectListItems        = GetAllBatchSlItems()
                            };
                            return(View(model));
                        }
                    }
                }
            }
            ModelState.AddModelError("", "An Unknown Error Occured!");
            entity.OrganizationSelectListItems = GetAllOrganizationSlItems();
            entity.CourseSelectListItems       = GetAllCourseSlItems();
            entity.BatchSelectListItems        = GetAllBatchSlItems();
            return(View(entity));
        }