コード例 #1
0
ファイル: GroupBL.cs プロジェクト: Thirlan/insideword
 public static bool Save(GroupRegisterVM model, ProviderGroup aGroup)
 {
     if (aGroup.IsNew)
     {
         aGroup.CreateDate = DateTime.UtcNow;
     }
     aGroup.Name = model.Name;
     aGroup.EditDate = DateTime.UtcNow;
     aGroup.Save();
     return true;
 }
コード例 #2
0
ファイル: GroupViewModels.cs プロジェクト: Thirlan/insideword
 public bool Parse(ProviderGroup aGroup, ProviderCurrentMember currentMember)
 {
     PageTitle = "Group: " + aGroup.Name;
     Members = aGroup.Members.ConvertAll<MemberVM>(aMember => new MemberVM(aMember, currentMember));
     RolesWithoutGlobal = aGroup.RolesWithoutGlobal;
     RolesWithGlobal = aGroup.RolesWithGlobal;
     RolesGloballyInherited = aGroup.RolesGloballyInherited;
     Articles = aGroup.Articles;
     Photos = aGroup.Photos;
     return true;
 }
コード例 #3
0
ファイル: GroupViewModels.cs プロジェクト: Thirlan/insideword
 public GroupDetailVM(ProviderGroup aGroup, ProviderCurrentMember currentMember)
 {
     Parse(aGroup, currentMember);
 }
コード例 #4
0
ファイル: GroupViewModels.cs プロジェクト: Thirlan/insideword
 public bool Parse(ProviderGroup aGroup)
 {
     PageTitle = "Manage: " + aGroup.Name;
     return true;
 }
コード例 #5
0
ファイル: GroupViewModels.cs プロジェクト: Thirlan/insideword
 public GroupManageVM(ProviderGroup aGroup)
 {
     Parse(aGroup);
 }
コード例 #6
0
ファイル: GroupController.cs プロジェクト: Thirlan/insideword
        public virtual ActionResult Register(GroupRegisterVM model)
        {
            ActionResult returnValue = null;
            ProviderCurrentMember currentMember = ProviderCurrentMember.Instance;
            if (!currentMember.IsActive)
            {
                MessageVM messageModel = new MessageVM
                {
                    Image = ImageLibrary.Alert,
                    CssClassContainer = "failure",
                    Message = "You must first activate an account with us before you can register a Group",
                    Title = ErrorStrings.TITLE_WARNING,
                    LinkText = "Continue",
                    LinkHref = Url.Action(MVC.Home.Index()),
                };

                returnValue = View("Message", messageModel);
            }
            else if (ModelState.IsValid)
            {
                ProviderGroup aGroup = new ProviderGroup();
                if (!GroupBL.Save(model, aGroup))
                {
                    var viewModel = new MessageVM
                    {
                        Image = ImageLibrary.Alert,
                        CssClassContainer = "failure",
                        Message = "Failed to activate group.  Please <a href=\"" + Url.Action(MVC.Info.ContactUs()) + "\">contact us</a> to resolve the issue.",
                        Title = "Group registration failure",
                        LinkText = "Continue",
                        LinkHref = Url.Action(MVC.Home.Index())
                    };
                    returnValue = View("Message", viewModel);
                }
                else
                {
                    var viewModel = new MessageVM
                    {
                        Image = ImageLibrary.Success,
                        CssClassContainer = "info",
                        Message = "Your Group has been created:",
                        Title = "Group created",
                        Details = new List<string>
                        {
                            "<a href='" + Url.Action( MVC.Group.Details(aGroup.Id.Value) ) + "' class='button'>View</a>  your group",
                            "<a href='" + Url.Action( MVC.Group.Manage(aGroup.Id.Value) ) + "' class='button'>Manage</a> your group"
                        }
                    };
                    returnValue = View("Message", viewModel);
                }
            }

            if (returnValue == null)
            {
                returnValue = View(model);
            }

            return returnValue;
        }