コード例 #1
0
        public ActionResult Views(string id)
        {
            identity = ((CustomPrincipal)User).CustomIdentity;
            var model    = new Cause();
            int cause_id = Convert.ToInt32(id);

            var item = _cDAC.SelectCauseById(cause_id);

            model.ID             = item.ID;
            model.IMG_URL        = item.IMG_URL;
            model.TOPIC          = item.TOPIC;
            model.DESCRIPTION    = item.DESCRIPTION;
            model.CREATED_BY     = item.CREATED_BY;
            model.CREATED_DATE   = item.CREATED_DATE;
            model.SignatureCount = _signatureDAC.CountSignatures(item.ID);
            model.Creator        = _cDAC.getCauseCreator(item.CREATED_BY);
            model.ISigned        = _signatureDAC.ISigned(identity.ProfileId, item.ID);
            model.Signatures     = _signatureDAC.getSignatures(item.ID);

            return(View(model));
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: worldwayii/Causes
        public ActionResult Index()
        {
            identity = ((CustomPrincipal)User).CustomIdentity;
            List <Cause> model = new List <Cause>();
            var          items = _causesDAC.SelectAllCauses();

            foreach (var item in items)
            {
                Cause cause = new Cause();
                cause.ID             = item.ID;
                cause.IMG_URL        = item.IMG_URL;
                cause.TOPIC          = item.TOPIC;
                cause.DESCRIPTION    = item.DESCRIPTION;
                cause.CREATED_BY     = item.CREATED_BY;
                cause.CREATED_DATE   = item.CREATED_DATE;
                cause.SignatureCount = _signatureDAC.CountSignatures(item.ID);
                cause.Creator        = _causesDAC.getCauseCreator(item.CREATED_BY);
                cause.ISigned        = _signatureDAC.ISigned(identity.ProfileId, item.ID);
                model.Add(cause);
            }
            return(View(model));
        }