Ejemplo n.º 1
0
        public UniversityAgreementsViewModel GetUniversityAgreements()
        {
            var model = new UniversityAgreementsViewModel();

            using (var db = new ErasmusDbContext())
            {
                model.UniversityAgreements.AddRange(db.UniversityAgreements.ToList().Select(x =>
                                                                                            new UniversityAgreementsView()
                {
                    Id = x.Id,
                    SourceUniversity = x.SourceUniversity.Name,
                    TargetUniversity = x.TargetUniversity.Name
                }));
            }
            return(model);
        }
Ejemplo n.º 2
0
        public UniversityAgreementsViewModel GetUniversityAgreements(string userId)
        {
            var model = new UniversityAgreementsViewModel();

            using (var db = new ErasmusDbContext())
            {
                var user = db.Users.SingleOrDefault(x => x.Id == userId);
                model.UniversityAgreements.AddRange(db.UniversityAgreements.Where(x => x.SourceUniversityId == user.UniversityId).ToList().Select(x =>
                                                                                                                                                  new UniversityAgreementsView()
                {
                    Id = x.Id,
                    SourceUniversity = x.SourceUniversity.Name,
                    TargetUniversity = x.TargetUniversity.Name
                }));
            }
            return(model);
        }
Ejemplo n.º 3
0
        public ActionResult UniversityAgreements()
        {
            UniversityAgreementsViewModel model = _adminBusinessLogic.GetUniversityAgreements();

            return(View(model));
        }
Ejemplo n.º 4
0
        public ActionResult UniversityAgreements()
        {
            UniversityAgreementsViewModel model = _uniAdminBusinessLogic.GetUniversityAgreements(User.Identity.GetUserId());

            return(View(model));
        }