public ActionResult<IEnumerable<Magazine>> Get()
 {
   try
   {
     return Ok(_ms.Get());
   }
   catch (Exception e)
   {
     return BadRequest(e.Message);
   }
 }//endof Get
        public IHttpActionResult GetData(int?id = null)
        {
            var magazinesDto = _magazineService.Get();

            if (id != null)
            {
                magazinesDto = _magazineService.Get().Where(b => b.Id == id);
            }

            var magazinesForView = Mapper.Map <IEnumerable <MagazineDTO>, List <MagazineViewModel> >(magazinesDto);

            return(Ok(magazinesForView));
        }
        public ActionResult Edit(int id)
        {
            MagazineViewModel magazine = _magazineService.Get(id);

            if (magazine != null)
            {
                return(View("Edit", magazine));
            }
            return(HttpNotFound());
        }
        // GET: Magazine/Edit/5
        public ActionResult Edit(int?id)
        {
            var allArticle = db.GetAllArticle();
            var cc         = db.Get(id);
            var art        = new HashSet <int>(cc.Articles.Select(c => c.id));
            var viewModel  = new List <Assosiat <ArticleView> >();

            foreach (var cour in allArticle)
            {
                Assosiat <ArticleView> ass = new Assosiat <ArticleView>();
                ass.Assigned = art.Contains(cour.id);
                ass.Name     = cour.Name;
                ass.ID       = cour.id;
                viewModel.Add(ass);
            }

            ViewBag.AllArticle = viewModel;

            return(View(db.Get(id)));
        }
Exemple #5
0
        public FileResult GetImage(int?id)
        {
            MagazineView art = db.Get(id);

            if (art != null)
            {
                return(File(art.ImageData, art.ImageMimeType));
            }
            else
            {
                return(null);
            }
        }
Exemple #6
0
        public IActionResult Get()
        {
            var magazines = _service.Get();

            return(Ok(magazines.ToList()));
        }
Exemple #7
0
 public ActionResult Magazines()
 {
     return(View(magazineService.Get()));
 }
Exemple #8
0
        public ActionResult Get(int id)
        {
            MagazineViewModel magazine = _magazineService.Get(id);

            return(View(magazine));
        }