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; }
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; }
public GroupDetailVM(ProviderGroup aGroup, ProviderCurrentMember currentMember) { Parse(aGroup, currentMember); }
public bool Parse(ProviderGroup aGroup) { PageTitle = "Manage: " + aGroup.Name; return true; }
public GroupManageVM(ProviderGroup aGroup) { Parse(aGroup); }
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; }