Ejemplo n.º 1
0
        public DomainModelResponse RemoveUserFromGroup(UpdateUserGroup request)
        {
            AspNetUsers up = _repUser.Get(filter: f => f.Email == request.emailId).FirstOrDefault();

            if (up == null)
            {
                _securityResponse.addResponse("RemoveUserFromGroup", MessageCodes.ErrDoesnotExist, "User : "******"RemoveUserFromGroup", MessageCodes.ErrDoesnotExist, "Course : " + request.courseCode);
                throw _securityResponse;
            }

            EntityModel.CourseUser cur = _repCourseUserRole.Get(filter: f => f.UserId == up.Id && f.CourseId == course.CourseId).FirstOrDefault();
            if (cur == null)
            {
                _securityResponse.addResponse("RemoveUserFromGroup", MessageCodes.ErrDoesnotExist, "CourseUserRole for User : "******"RemoveUserFromGroup", MessageCodes.InfoSavedSuccessfully, "CourseUserRole for user : " + request.emailId);
            return(_securityResponse);
        }
Ejemplo n.º 2
0
 public bool RemoveUserFromGroup(UpdateUserGroup request)
 {
     try
     {
         user.RemoveUserFromGroup(request);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
 public bool AddUserToGroup(UpdateUserGroup request)
 {
     try
     {
         user.AddUserToGroup(request);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
        public IApiResult Update(UpdateUserGroup operation)
        {
            var result = operation.ExecuteAsync().Result;

            if (result is ValidationsOutput)
            {
                return(new ApiResult <List <ValidationItem> >()
                {
                    Data = ((ValidationsOutput)result).Errors
                });
            }
            else
            {
                return(new ApiResult <object>()
                {
                    Status = ApiResult <object> .ApiStatus.Success
                });
            }
        }
Ejemplo n.º 5
0
        public ActionResult LeaveGroup(string groupCode, string courseCode)
        {
            UpdateUserGroup uug = new UpdateUserGroup()
            {
                courseCode = courseCode,
                GroupCode  = groupCode,
                emailId    = User.Identity.Name
            };
            bool result = _userCom.RemoveUserFromGroup(uug);

            if (result)
            {
                return(RedirectToAction("GroupSummary", "Group", routeValues: new { courseCode = courseCode }));
            }
            else
            {
                ModelState.AddModelError("", "Oops! Something wrong happened! Please try again.");
                return(RedirectToAction("GroupDetail", "Group", routeValues: new { groupCode = groupCode }));
            }
        }