Exemple #1
0
        public ActionResult UpdateApplyStatus(int appId, string email, ApplyingStatus applyingStatus)
        {
            string userId = User.Identity.GetUserId();


            ApplyForScholarshipDTO model = new ApplyForScholarshipDTO()
            {
                Id = appId
                ,
                ApplyingStatus = applyingStatus,
            };


            bool checkSuccess = _manager.Update(model);

            if (checkSuccess)
            {
                var singleApply = _manager.GetById(appId);
                _sendEmailHelper.sendEmailConfirmation(email, applyingStatus);

                return(RedirectToAction("GetUsersAppliedToScholarShipBySchId", routeValues: new { SchId = singleApply.ScholarshipId }));

                // return RedirectToAction("Index", "Scholarship");
            }


            return(View());
        }
 public bool Update(ApplyForScholarshipDTO applyViewModel)
 {
     try
     {
         AUCTechnicalTask_AhmedMohammedRabie.DL.Models.ApplyForScholarship ApplyForScholarship = _repository.Get(applyViewModel.Id);
         ApplyForScholarship.ApplyingStatus = applyViewModel.ApplyingStatus;
         _repository.Update(ApplyForScholarship);
         return(_unitOfWork.SaveChanges());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public ApplyForScholarshipDTO GetById(int id)
        {
            try
            {
                var ScholarshipApply = _repository.Get(id);


                ApplyForScholarshipDTO query = ScholarshipApply != null ? new ApplyForScholarshipDTO()
                {
                    ApplyingStatus = ScholarshipApply.ApplyingStatus,
                    ScholarshipId  = ScholarshipApply.ScholarshipId,
                    UserId         = ScholarshipApply.UserId,
                } : null;
                return(query);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public bool Create(ApplyForScholarshipDTO item)
        {
            try
            {
                AUCTechnicalTask_AhmedMohammedRabie.DL.Models.ApplyForScholarship ApplyForScholarship = new AUCTechnicalTask_AhmedMohammedRabie.DL.Models.ApplyForScholarship()
                {
                    Message        = item.Message,
                    UserId         = item.UserId,
                    ScholarshipId  = item.ScholarshipId,
                    ApplyingStatus = DL.Enums.ApplyingStatus.NoAction,
                    AddUserId      = item.UserId,
                };
                _repository.Add(ApplyForScholarship);

                return(_unitOfWork.SaveChanges());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #5
0
        public ActionResult Create(string message, int schId)
        {
            string userId = User.Identity.GetUserId();


            ApplyForScholarshipDTO model = new ApplyForScholarshipDTO()
            {
                Message       = message,
                ScholarshipId = schId,
                UserId        = userId,
            };


            bool checkSuccess = _manager.Create(model);

            if (checkSuccess)
            {
                return(RedirectToAction("Index", "Home"));
            }

            return(View());
        }