public async Task <ActionResult> Registrations()
        {
            var registrations = (await _context.GetAll())
                                .Select(x => x.ToView())
                                .ToList();

            return(Ok(registrations));
        }
Example #2
0
        public IActionResult GetRegistrationRequests()
        {
            var data = _registrationRepository
                       .GetAll()
                       .Select(r => new RegistrationRequestDto
            {
                Email = r.Email, UserName = r.UserName, Id = r.Id
            });

            return(Ok(data));
        }
Example #3
0
        public RegistrationModel[] GetAll(int userId)
        {
            var items = registrationRepository.GetAll(userId)
                        .Select(t =>
            {
                var classes = classRepository.GetClass(t.ClassId);

                return(new RegistrationModel
                {
                    ClassId = t.ClassId,
                    ClassName = classes.Name,
                    ClassPrice = classes.Price
                });
            })
                        .ToArray();

            return(items);
        }
Example #4
0
        public IEnumerable <RegistrationDto> GetAll()
        {
            var registrationList = _registrationRepository.GetAll();

            if (registrationList.Any())
            {
                var registrationDtoList = registrationList.Select(c => new RegistrationDto
                {
                    Id        = c.Id,
                    CourseId  = c.CourseId,
                    StudentId = c.StudentId,
                    Value     = c.Value
                });

                return(registrationDtoList);
            }

            return(null);
        }
Example #5
0
 public IEnumerable GetAllRegistrants()
 {
     return(repository.GetAll());
 }
        public ActionResult NewRegistration(Registration model)
        {
            if (Convert.ToInt32(model.ViiiMm) > 0 && Convert.ToInt32(model.ViiiMo) == 0)
            {
                ModelState.AddModelError("ViiiMo", "Invalid marks provided.");
            }
            if (Convert.ToInt32(model.ViiiMo) > 0 && Convert.ToInt32(model.ViiiMm) == 0)
            {
                ModelState.AddModelError("ViiiMo", "Invalid marks provided.");
            }
            if (Convert.ToInt32(model.ViiiMm) > 0 && Convert.ToInt32(model.ViiiYear) < 1950)
            {
                ModelState.AddModelError("ViiiMo", "Invalid Year.");
            }

            if (Convert.ToInt32(model.Hsmm) > 0 && Convert.ToInt32(model.Hsmo) == 0)
            {
                ModelState.AddModelError("HsMo", "Invalid marks provided.");
            }
            if (Convert.ToInt32(model.Hsmo) > 0 && Convert.ToInt32(model.Hsmm) == 0)
            {
                ModelState.AddModelError("Hsmo", "Invalid marks provided.");
            }
            if (Convert.ToInt32(model.Hsmm) > 0 && Convert.ToInt32(model.Hsyear) < 1950)
            {
                ModelState.AddModelError("Hsmo", "Invalid Year.");
            }

            if (Convert.ToInt32(model.Immm) > 0 && Convert.ToInt32(model.Immo) == 0)
            {
                ModelState.AddModelError("Immo", "Invalid marks provided.");
            }
            if (Convert.ToInt32(model.ViiiMo) > 0 && Convert.ToInt32(model.ViiiMm) == 0)
            {
                ModelState.AddModelError("Immo", "Invalid marks provided.");
            }
            if (Convert.ToInt32(model.ViiiMm) > 0 && Convert.ToInt32(model.ViiiYear) < 1950)
            {
                ModelState.AddModelError("Immo", "Invalid Year.");
            }

            if (Convert.ToInt32(model.GrMm) > 0 && Convert.ToInt32(model.GrMo) == 0)
            {
                ModelState.AddModelError("GrMo", "Invalid marks provided.");
            }
            if (Convert.ToInt32(model.GrMo) > 0 && Convert.ToInt32(model.GrMm) == 0)
            {
                ModelState.AddModelError("GrMo", "Invalid marks provided.");
            }
            if (Convert.ToInt32(model.GrMm) > 0 && Convert.ToInt32(model.GrYear) < 1950)
            {
                ModelState.AddModelError("GrMo", "Invalid Year.");
            }

            if (Convert.ToInt32(model.PgMm) > 0 && Convert.ToInt32(model.PgMo) == 0)
            {
                ModelState.AddModelError("PgMo", "Invalid marks provided.");
            }
            if (Convert.ToInt32(model.PgMo) > 0 && Convert.ToInt32(model.PgMm) == 0)
            {
                ModelState.AddModelError("PgMo", "Invalid marks provided.");
            }
            if (Convert.ToInt32(model.PgMm) > 0 && Convert.ToInt32(model.PgYear) < 1950)
            {
                ModelState.AddModelError("PgMo", "Invalid Year.");
            }

            if (Convert.ToInt32(model.OtherMm) > 0 && Convert.ToInt32(model.OtherMo) == 0)
            {
                ModelState.AddModelError("OtherMo", "Invalid marks provided.");
            }
            if (Convert.ToInt32(model.OtherMo) > 0 && Convert.ToInt32(model.OtherMm) == 0)
            {
                ModelState.AddModelError("OtherMo", "Invalid marks provided.");
            }
            if (Convert.ToInt32(model.OtherMm) > 0 && Convert.ToInt32(model.OtherYear) < 1950)
            {
                ModelState.AddModelError("OtherMo", "Invalid Year.");
            }

            if (!ModelState.IsValid)
            {
                var _list = _districtRepository.GetAll();
                ViewBag.DistrictId  = new SelectList(_list, "DistrictId", "Name");
                ViewBag.DistrictId1 = new SelectList(_list, "DistrictId", "Name");
                ViewBag.DistrictId2 = new SelectList(_list, "DistrictId", "Name");
                ViewBag.DistrictId3 = new SelectList(_list, "DistrictId", "Name");
                ViewBag.DistrictId4 = new SelectList(_list, "DistrictId", "Name");
                ViewBag.DistrictId5 = new SelectList(_list, "DistrictId", "Name");

                var _blocks = _blockRepository.GetAll();
                if (model.DistrictId == 0)
                {
                    ViewBag.BlockId = new SelectList(null, "BlockId", "Name");
                }
                else
                {
                    ViewBag.BlockId = new SelectList(_blocks.Where(b => b.DistrictId == model.DistrictId), "BlockId", "Name");
                }

                var _posts = _postRepository.GetAll().OrderBy(c => c.Code).ThenBy(c => c.Name);
                ViewBag.PostId = new SelectList(_posts, "PostId", "Name");
                return(View(model));
            }

            var suffix = _registrationRepository.GetAll().Max(p => p.Suffix) + 1;

            model.Suffix            = suffix;
            model.Prefix            = "APEC";
            model.ApplicationNumber = "APEC" + suffix.ToString();
            model.RegDate           = DateTime.Today.Date;

            if (Convert.ToInt32(model.ViiiMo) > 0 && Convert.ToInt32(model.ViiiMm) > 0)
            {
                model.ViiiPer = Decimal.Round(Convert.ToDecimal((model.ViiiMo / model.ViiiMm) * 100), 2);
            }

            if (Convert.ToInt32(model.Hsmo) > 0 && Convert.ToInt32(model.Hsmm) > 0)
            {
                model.Hsper = Decimal.Round(Convert.ToDecimal((model.Hsmo / model.Hsmm) * 100), 2);
            }

            if (Convert.ToInt32(model.Immo) > 0 && Convert.ToInt32(model.Immm) > 0)
            {
                model.ImPer = Decimal.Round(Convert.ToDecimal((model.Immo / model.Immm) * 100), 2);
            }

            if (Convert.ToInt32(model.GrMo) > 0 && Convert.ToInt32(model.GrMm) > 0)
            {
                model.GrPer = Decimal.Round(Convert.ToDecimal((model.GrMo / model.GrMm) * 100), 2);
            }

            if (Convert.ToInt32(model.PgMo) > 0 && Convert.ToInt32(model.PgMm) > 0)
            {
                model.PgPer = Decimal.Round(Convert.ToDecimal((model.PgMo / model.PgMm) * 100), 2);
            }

            if (Convert.ToInt32(model.OtherMo) > 0 && Convert.ToInt32(model.OtherMm) > 0)
            {
                model.OtherPer = (model.OtherMo / model.OtherMm) * 100;
            }

            _registrationRepository.Add(model);
            unitOfWork.SaveChanges();
            return(View());
        }
 public List <SubmittedGeneralRegistrationForm> GetAll()
 {
     return(_repository.GetAll().ToList());
 }
 public IEnumerable <School> GetAll()
 {
     return(_repository.GetAll().Where(s => s.IsAvailableForRegistration == true));
 }
        // GET: Registrations
        public async Task <ActionResult> Index()
        {
            var registrations = await _repository.GetAll();

            return(View(registrations));
        }
 public List <SubmittedPreKApplicationForm> GetAll()
 {
     return(_repository.GetAll().ToList());
 }
Example #11
0
 public ActionResult List()
 {
     return(View(registrationRepository.GetAll()));
 }
        public IActionResult GetAll()
        {
            List <Registration> list = registrationRepository.GetAll().ToList();

            return(new JsonResult(list));
        }