public PartialViewResult AssignAlumni(int id)
 {
     var mentor = _db.MentorShips.Find(id);
     var model = new MentorStatusUpdateVm{
         Id = id,
         Status = mentor.Status
     };
     return PartialView(model);
 }
        private MentorShip UpdateStatusAddMsg(MentorStatusUpdateVm model)
        {
            var user = CurrentUser;
            var mentor = _db.MentorShips.Include(m => m.Messages).Single(m => m.MentorShipId == model.Id);
            if (!user.IsAdmin() && mentor.AlumniId != user.UserId && mentor.StudentId != user.UserId)
            {
                LogUnAuth();
                throw new Exception(Strings.UnAuthAccess);
            }
            if (ModelState.IsValid)
            {
                if (mentor.Status != model.Status)
                {
                    if (model.Status == MentorStatusType.AdminApproved)
                    {
                        if (model.AcUserId == 0)
                        {
                            ModelState.AddModelError("", "Select Mentor");
                            return null;
                        }
                        else
                        {
                            var mentorUser = _db.Users.Find(model.AcUserId);
                            mentor.AlumniId = mentorUser.UserId;
                            mentor.AlumniName = mentorUser.FullName;
                            //MailSrv.SendMailAsync(mentorUser, "You have new mentoring request.", "NITCAA - Mentoring Request", null);
                        }
                    }

                    mentor.Status = model.Status == MentorStatusType.Message ? mentor.Status : model.Status;
                    var msg = GetUserMsg(model.Status);
                    var message = new MentorMessage
                    {
                        MentorShipId = mentor.MentorShipId,
                        Status = model.Status,
                        SenderId = CurrentUserId,
                        Date = DateTime.UtcNow,
                        Text = string.IsNullOrWhiteSpace(model.Message)
                                        ? msg
                                        : model.Message,
                        SenderName = CurrentUser.FullName,
                    };
                    _db.Entry(mentor).State = System.Data.EntityState.Modified;
                    _db.MentorMessages.Add(message);
                    _db.SaveChanges();
                }
            }
            return mentor;
        }
 public JsonResult UpdateStatus(MentorStatusUpdateVm model)
 {
     UpdateStatusAddMsg(model);
     return GetErrorMsgJSON();
 }