public PartialViewResult _AddUser(int?id, int?RoleId)
        {
            User user = new User();

            using (var client = new DatamantraAPIClient())
            {
                if (id > 0)
                {
                    string requestUri      = "User/GetUserDetailsByUserId?userId=" + id;
                    var    _courseResponse = client.GetAsync(requestUri).Result;
                    if (_courseResponse != null && _courseResponse.IsSuccessStatusCode)
                    {
                        user = _courseResponse.Content.ReadAsAsync <User>().Result;
                    }
                }
                string reqUri = "Admin/GetAllCategories";
                var    __lstCategoryResponse = client.GetAsync(reqUri).Result;
                if (__lstCategoryResponse != null && __lstCategoryResponse.IsSuccessStatusCode)
                {
                    var Categorylst = __lstCategoryResponse.Content.ReadAsAsync <List <Category> >().Result;
                    ViewData["Categorylist"] = new SelectList(Categorylst, "CategoryId", "CategoryName");
                }
            }
            user.RoleId = RoleId ?? 0;
            return(PartialView(user));
        }
        /// <summary>
        ///  Check Is Valid Email
        /// </summary>
        /// <returns></returns>
        public JsonResult CheckIsValidEmail(string email)
        {
            bool isduplicate = false;

            try
            {
                using (var client = new DatamantraAPIClient())
                {
                    string requestUri    = "User/CheckIsValidEmail?email=" + email;
                    var    _UserResponse = client.GetAsync(requestUri).Result;

                    TelemetryLogger.TrackTrace("Got User Res");
                    if (_UserResponse != null && _UserResponse.IsSuccessStatusCode)
                    {
                        var userRes = _UserResponse.Content.ReadAsAsync <string>().Result;
                        if (userRes != null && userRes == "True")
                        {
                            isduplicate = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                TelemetryLogger.TrackException(ex, "CheckIsValidEmail");
            }

            return(Json(isduplicate, JsonRequestBehavior.AllowGet));
        }
        public PartialViewResult _AddCourse(long?id)
        {
            Course course = new Course();

            if (id > 0)
            {
                using (var client = new DatamantraAPIClient())
                {
                    string requestUri      = "Admin/GetCourseDetailsByCourseId?id=" + id;
                    var    _courseResponse = client.GetAsync(requestUri).Result;
                    if (_courseResponse != null && _courseResponse.IsSuccessStatusCode)
                    {
                        course = _courseResponse.Content.ReadAsAsync <Course>().Result;
                    }
                }
            }
            using (var client = new DatamantraAPIClient())
            {
                string requestUri            = "Admin/GetAllCategories";
                var    __lstCategoryResponse = client.GetAsync(requestUri).Result;
                if (__lstCategoryResponse != null && __lstCategoryResponse.IsSuccessStatusCode)
                {
                    var Categorylst = __lstCategoryResponse.Content.ReadAsAsync <List <Category> >().Result;
                    ViewData["Categorylist"] = new SelectList(Categorylst, "CategoryId", "CategoryName");
                }
            }
            return(PartialView(course));
        }
        public PartialViewResult _AllUserRoles()
        {
            List <User> _activeuserlst = new List <User>();

            using (var client = new DatamantraAPIClient())
            {
                string requestUri    = "Admin/GetAllActiveUserDetails";
                var    _userResponse = client.GetAsync(requestUri).Result;
                if (_userResponse != null && _userResponse.IsSuccessStatusCode)
                {
                    _activeuserlst = _userResponse.Content.ReadAsAsync <List <User> >().Result;
                }
            }
            return(PartialView(_activeuserlst));
        }
        public PartialViewResult _AllRoles()
        {
            List <Role> _lstRole = new List <Role>();

            using (var client = new DatamantraAPIClient())
            {
                string requestUri     = "Admin/GetAllRoles";
                var    _rolesResponse = client.GetAsync(requestUri).Result;
                if (_rolesResponse != null && _rolesResponse.IsSuccessStatusCode)
                {
                    _lstRole = _rolesResponse.Content.ReadAsAsync <List <Role> >().Result;
                }
            }
            return(PartialView(_lstRole));
        }
        public PartialViewResult GetAllCourseByCategoryId(long CategoryId)
        {
            List <Course> Courselst = new List <Course>();

            using (var client = new DatamantraAPIClient())
            {
                string requestUri            = "Admin/GetAllCourseByCategoryId";
                var    __lstCategoryResponse = client.GetAsync(requestUri).Result;
                if (__lstCategoryResponse != null && __lstCategoryResponse.IsSuccessStatusCode)
                {
                    Courselst = __lstCategoryResponse.Content.ReadAsAsync <List <Course> >().Result;
                }
            }
            return(PartialView(Courselst));
        }
        public JsonResult GetAllCourselistByCategoryId(long CategoryId)
        {
            List <Course> Courselst = new List <Course>();

            using (var client = new DatamantraAPIClient())
            {
                string requestUri            = "Admin/GetAllCourseByCategoryId?CategoryId=" + CategoryId;
                var    __lstCategoryResponse = client.GetAsync(requestUri).Result;
                if (__lstCategoryResponse != null && __lstCategoryResponse.IsSuccessStatusCode)
                {
                    Courselst = __lstCategoryResponse.Content.ReadAsAsync <List <Course> >().Result;
                }
            }
            return(Json(Courselst, JsonRequestBehavior.AllowGet));
        }
        public PartialViewResult _AddCategory(long?id)
        {
            Category _category = new Category();

            using (var client = new DatamantraAPIClient())
            {
                string requestUri      = "Admin/GetCategoryById?id=" + id;
                var    _courseResponse = client.GetAsync(requestUri).Result;
                if (_courseResponse != null && _courseResponse.IsSuccessStatusCode)
                {
                    _category = _courseResponse.Content.ReadAsAsync <Category>().Result;
                }
            }
            return(PartialView(_category));
        }
        public JsonResult DeleteReviewbyReviewId(long id)
        {
            bool IsDeleted = false;

            using (var client = new DatamantraAPIClient())
            {
                string requestUri      = "User/DeleteReviewbyReviewId?id=" + id;
                var    _courseResponse = client.GetAsync(requestUri).Result;
                if (_courseResponse != null && _courseResponse.IsSuccessStatusCode)
                {
                    IsDeleted = _courseResponse.Content.ReadAsAsync <bool>().Result;
                }
            }
            return(Json(IsDeleted, JsonRequestBehavior.AllowGet));
        }
示例#10
0
        public ViewResult Courses()
        {
            List <Category> _lstCategory = new List <Category>();

            using (var client = new DatamantraAPIClient())
            {
                string requestUri            = "Admin/GetAllCategories";
                var    __lstCategoryResponse = client.GetAsync(requestUri).Result;
                if (__lstCategoryResponse != null && __lstCategoryResponse.IsSuccessStatusCode)
                {
                    _lstCategory = __lstCategoryResponse.Content.ReadAsAsync <List <Category> >().Result;
                }
            }
            return(View(_lstCategory));
        }
示例#11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public PartialViewResult _CourseListByStaffId(long?id)
        {
            //id= course id
            List <Course> courselst = new List <Course>();

            using (var client = new DatamantraAPIClient())
            {
                string requestUri = "Admin/GetCourseListByStaffId?id=" + id;
                var    userRes    = client.GetAsync(requestUri).Result;
                if (userRes != null && userRes.IsSuccessStatusCode)
                {
                    courselst = userRes.Content.ReadAsAsync <List <Course> >().Result;
                }
            }
            return(PartialView(courselst));
        }
示例#12
0
        public ActionResult StaffDetail(long id)
        {
            //id= course id
            User user = new User();

            using (var client = new DatamantraAPIClient())
            {
                string requestUri = "User/GetUserDetailsByUserId?userId=" + id;
                var    userRes    = client.GetAsync(requestUri).Result;
                if (userRes != null && userRes.IsSuccessStatusCode)
                {
                    user = userRes.Content.ReadAsAsync <User>().Result;
                }
            }
            return(View(user));
        }
示例#13
0
        public ActionResult Staffs()
        {
            //id= course id
            List <User> userlst = new List <User>();

            using (var client = new DatamantraAPIClient())
            {
                string requestUri = "User/GetAllUserDetailsbyRoleandStatus?RoleId=2&ActiveStatus=true";
                var    userRes    = client.GetAsync(requestUri).Result;
                if (userRes != null && userRes.IsSuccessStatusCode)
                {
                    userlst = userRes.Content.ReadAsAsync <List <User> >().Result;
                }
            }
            return(View(userlst));
        }
示例#14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public PartialViewResult _StaffList(long?CourseId)
        {
            //id= course id
            List <User> userlst = new List <User>();

            using (var client = new DatamantraAPIClient())
            {
                string requestUri = "User/GetStaffDetailsByCourseId?CourseId=" + CourseId;
                var    userRes    = client.GetAsync(requestUri).Result;
                if (userRes != null && userRes.IsSuccessStatusCode)
                {
                    userlst = userRes.Content.ReadAsAsync <List <User> >().Result;
                }
            }
            return(PartialView(userlst));
        }
示例#15
0
        /// <summary>
        ///   Course Review List By Course Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public PartialViewResult _CourseReviewList(long?id)
        {
            //id= course id
            List <Review> reviewLst = new List <Review>();

            using (var client = new DatamantraAPIClient())
            {
                string requestUri = "User/GetCourseReviewListByCourseId?id=" + id;
                var    userRes    = client.GetAsync(requestUri).Result;
                if (userRes != null && userRes.IsSuccessStatusCode)
                {
                    reviewLst = userRes.Content.ReadAsAsync <List <Review> >().Result;
                }
            }
            ViewData["CourseId"] = id ?? 0;
            return(PartialView(reviewLst));
        }
示例#16
0
        public PartialViewResult _ViewRole(long?id)
        {
            Role role = new Role();

            if (id > 0)
            {
                using (var client = new DatamantraAPIClient())
                {
                    string requestUri      = "Admin/GetRolesById?id=" + id;
                    var    _courseResponse = client.GetAsync(requestUri).Result;
                    if (_courseResponse != null && _courseResponse.IsSuccessStatusCode)
                    {
                        role = _courseResponse.Content.ReadAsAsync <Role>().Result;
                    }
                }
            }
            return(PartialView(role));
        }
示例#17
0
        public PartialViewResult _CourseDetail(long?id)
        {
            Course course = new Course();

            if (id > 0)
            {
                using (var client = new DatamantraAPIClient())
                {
                    string requestUri = "Admin/GetCourseDetailsByCourseId?id=" + id;
                    var    courseRes  = client.GetAsync(requestUri).Result;
                    if (courseRes != null && courseRes.IsSuccessStatusCode)
                    {
                        course = courseRes.Content.ReadAsAsync <Course>().Result;
                    }
                }
            }
            return(PartialView(course));
        }
示例#18
0
        public JsonResult GetAllCourse(string searchText)
        {
            List <Course> _lstcourse = new List <Course>();

            using (var client = new DatamantraAPIClient())
            {
                string requestUri      = "Admin/GetAllCourse";
                var    _courseResponse = client.GetAsync(requestUri).Result;
                if (_courseResponse != null && _courseResponse.IsSuccessStatusCode)
                {
                    _lstcourse = _courseResponse.Content.ReadAsAsync <List <Course> >().Result;
                    if (_lstcourse != null && _lstcourse.Any())
                    {
                        _lstcourse = _lstcourse.Where(x => x.CourseName.ToLower().Contains(searchText)).ToList();
                    }
                }
            }
            return(Json(_lstcourse, JsonRequestBehavior.AllowGet));
        }
示例#19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public PartialViewResult _AllUserbyRoleId(long id, bool ActiveStatus)
        {
            List <User> userlst = new List <User>();

            if (id > 0)
            {
                using (var client = new DatamantraAPIClient())
                {
                    string requestUri = "User/GetAllUserDetailsbyRoleandStatus?RoleId=" + id + "&ActiveStatus=" + ActiveStatus;
                    var    userRes    = client.GetAsync(requestUri).Result;
                    if (userRes != null && userRes.IsSuccessStatusCode)
                    {
                        userlst = userRes.Content.ReadAsAsync <List <User> >().Result;
                    }
                }
                ViewData["RoleId"]       = id;
                ViewData["ActiveStatus"] = ActiveStatus;
            }
            return(PartialView(userlst));
        }
示例#20
0
 public JsonResult UpdateUserRoles(long roleId, long userId)
 {
     if (roleId > 0 && userId > 0)
     {
         using (var client = new DatamantraAPIClient())
         {
             string requestUri    = "Admin/UpdateUserRoles?userId=" + userId + "&roleId=" + roleId;
             var    _userResponse = client.GetAsync(requestUri).Result;
             if (_userResponse != null && _userResponse.IsSuccessStatusCode)
             {
                 bool isupdated = _userResponse.Content.ReadAsAsync <bool>().Result;
                 if (!isupdated)
                 {
                     roleId = 0;
                 }
             }
         }
     }
     return(Json(roleId, JsonRequestBehavior.AllowGet));
 }