示例#1
0
        public IActionResult Notices()
        {
            ApplicationUser user = _userManager.GetUserAsync(User).Result;

            Masjid masjid = Repository.Find <Masjid>(s => s.Id == user.MasjidId).FirstOrDefault();

            NoticesViewModel Model = new NoticesViewModel();

            Model.MasjidId = masjid.Id;

            Model.Notices = Repository
                            .Find <Notice>(s => s.MasjidId == masjid.Id)
                            .Include(s => s.Created)
                            .ToList();

            return(View(Model));
        }
        public ActionResult Index()    //补充:处理通知公告的部分
        {
            var notices = (from o in db.notice_table
                           select new { o.ID, o.vital, o.title, o.time }).ToArray();
            List <NoticesViewModel> model = new List <NoticesViewModel>();

            for (int i = 0; i < notices.Length; i++)
            {
                NoticesViewModel m = new NoticesViewModel();
                m.newsID = notices[i].ID;
                m.vital  = notices[i].vital;
                m.title  = notices[i].title;
                m.time   = notices[i].time;
                model.Add(m);
            }
            return(View(model));
        }
 public NoticesPage()
 {
     InitializeComponent();
     BindingContext = model = new NoticesViewModel();
 }