public ActionResult CreateAssignmentGroupUser(long assignmentGroupId)
        {
            var assignmentGroupUser = new AssignmentGroupUser
            {
                IsNew             = true,
                AssignmentGroupId = assignmentGroupId
            };

            _assignmentGroupUserRepository.InsertAndCommit(assignmentGroupUser);

            var model = new AssignmentGroupUserModel();

            model = assignmentGroupUser.ToModel();
            var html = this.AssignmentGroupUserPanel(model);

            return(Json(new { Id = assignmentGroupUser.Id, Html = html }));
        }
 public ActionResult SaveAssignmentGroupUser(AssignmentGroupUserModel model)
 {
     if (ModelState.IsValid)
     {
         var assignmentGroupUser = _assignmentGroupUserRepository.GetById(model.Id);
         //always set IsNew to false when saving
         assignmentGroupUser.IsNew         = false;
         assignmentGroupUser.SiteId        = model.SiteId;
         assignmentGroupUser.UserId        = model.UserId;
         assignmentGroupUser.IsDefaultUser = model.IsDefaultUser;
         _assignmentGroupUserRepository.UpdateAndCommit(assignmentGroupUser);
         return(new NullJsonResult());
     }
     else
     {
         return(Json(new { Errors = ModelState.Errors().ToHtmlString() }));
     }
 }
        public string AssignmentGroupUserPanel(AssignmentGroupUserModel model)
        {
            var html = this.RenderPartialViewToString("_AssignmentGroupUserDetails", model);

            return(html);
        }