Пример #1
0
 public IActionResult Search(string message, int?id)
 {
     try
     {
         if (id != null)
         {
             ViewBag.Obuka = id;
         }
         else
         {
             ViewBag.Obuka = null;
         }
         ViewBag.ListaPasa  = service.GetAll().ToList();
         ViewBag.ListaObuka = serviceObuka.GetAll().ToList();
         if (message == null)
         {
             message = string.Empty;
         }
         ViewBag.Message = message;
         return(View());
     }
     catch (Exception ex)
     {
         return(RedirectToAction("Error", "Home", new { message = ex.Message }));
     }
 }
Пример #2
0
        public ActionResult <IEnumerable <Obuka> > Get()
        {
            var obuke    = _service.GetAll().ToList();
            var obukeDTO = _mapper.Map <IEnumerable <ObukaDTO> >(obuke);

            return(Ok(obukeDTO));
        }
Пример #3
0
        private void ObukeDropDownList(object izabranaObuka = null)
        {
            var obukeQuery = from o in service.GetAll().AsQueryable()
                             orderby o.Naziv
                             select o;

            ViewBag.ObukaId = new SelectList(obukeQuery.AsNoTracking(), "Id", "Naziv", izabranaObuka);
        }
Пример #4
0
        public IActionResult Index()

        {
            ViewBag.Obuke = service.GetAll().ToList();
            return(View(service.GetAll().ToList()));
        }