Exemple #1
0
        public IActionResult GetById(string menteeId)
        {
            BaseResponseDto <MenteeModel> responseDto = null;
            ICollection <MenteeModel>     result      = null;

            if (menteeId == null)
            {
                return(BadRequest("Mentee Id must not be null"));
            }

            try
            {
                responseDto = _mentee.GetById(menteeId);
            }
            catch (Exception e)
            {
                return(StatusCode(500, e));
            }


            if (responseDto.Status == 1)
            {
                return(BadRequest(responseDto.Message));
            }

            if (responseDto.Status == 2)
            {
                return(Ok(responseDto.Message));
            }

            //  finalize
            result = responseDto.Content.ToList();
            return(Ok(result));
        }
Exemple #2
0
        public ActionResult Remove(int id)
        {
            var mentor = _mentorService.GetById(id);

            var removeMentor = new RemoveMentor
            {
                Id   = id,
                Name = mentor.User.Name
            };

            foreach (var m in mentor.Mentees)
            {
                var mentee = _menteeService.GetById(m.Id);
                removeMentor.MenteeNames.Add(mentee.User.Name);
            }

            return(View(removeMentor));
        }
Exemple #3
0
        public ActionResult Remove(int id)
        {
            var mentee = _menteeService.GetById(id);

            var removeMentee = new RemoveMentee
            {
                Id   = id,
                Name = mentee.User.Name
            };

            if (mentee.Mentor != null)
            {
                var mentor = _mentorService.GetById(mentee.Mentor.Id);
                removeMentee.MentorName = mentor.User.Name;
            }

            return(View(removeMentee));
        }