Exemplo n.º 1
0
        private static IWritable DrawProposalActions(Proposal proposal, User user)
        {
            List <IWritable> components = new List <IWritable>();

            if (proposal.Status == ProposalStatus.Created)
            {
                if (user.Equals(proposal.User))
                {
                    components.Add(A(ResolveUri.ForEditProposal(proposal), "Edit"));
                }

                if (user.Role.Equals(Role.Administrator))
                {
                    components.Add(Form("post", ResolveUri.ForAcceptProposal(proposal), InputSubmit("Accept")));
                }

                components.Add(Form("post", ResolveUri.ForRejectProposal(proposal), InputSubmit("Reject")));
            }

            var elem = Div("controls", "actions"
                           , components.ToArray()
                           );

            return(elem);
        }