Beispiel #1
0
 public void OnGet(int?id)
 {
     if (id != null)
     {
         var newsId         = Convert.ToInt32(id);
         var fechnewsfromDb = this.News = _unitofwork.newsRepo.Get(x => x.Id == newsId);
         if (fechnewsfromDb != null)
         {
             this.News = fechnewsfromDb;
         }
     }
 }
Beispiel #2
0
        public void OnGet(int?id)
        {
            var categorylist = _unitofwork.catageryRepo.GetAll().ToList();

            CategoryList = categorylist.Select(x => new SelectListItem
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            }).ToList();


            if (id != null)
            {
                var newsId         = Convert.ToInt32(id);
                var fechnewsfromDb = this.News = _unitofwork.newsRepo.Get(x => x.Id == newsId);
                if (fechnewsfromDb != null)
                {
                    this.News = fechnewsfromDb;
                }
            }
        }