// GET: TypeHomologIS/Delete/5
 public bool Delete([FromBody] VrsteHomologacijeModel vrstaHomologacije)
 {
     try
     {
         return(VrsteHomologacijeDAO.DeleteHomologisType(vrstaHomologacije.Id));
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 2
0
        public ActionResult CreateAttr()
        {
            if (HttpContext.Session.GetObjectFromJson <KorisnikModel>("LogovaniKorisnik") == null)
            {
                return(View("~/Views/Login/Index.cshtml"));
            }

            ViewBagModel      viewBag      = new ViewBagModel();
            GlavnaMasterModel glavnaMaster = GlavnaDAO.GetMasterObjectById(Convert.ToInt32(HttpContext.Session.GetInt32("GlavnaMasterID")));

            viewBag.GlavnaMaster = glavnaMaster;
            viewBag.Glavna.VrstaHomologacije.AtributSet = VrsteHomologacijeDAO.GetAtributSet(VrstaHomologacijeID);
            viewBag.AtributSet = viewBag.Glavna.VrstaHomologacije.AtributSet; // Test Stavio Atribut Set u View Bag Model
            return(View("Create", viewBag));
        }
        public async Task <object> GetFeatures(DataSourceLoadOptions loadOptions)
        {
            try
            {
                var    karakteristike = VrsteHomologacijeDAO.GetAllKarakteristikeHomologacije();
                object result         = await Task.Run(() => DataSourceLoader.Load(karakteristike, loadOptions));

                return(result);
            }
            catch (Exception)
            {
                object result = await Task.Run(() => DataSourceLoader.Load(new List <KarakteristikaModel>(), loadOptions));

                return(result);
            }
        }
        public async Task <object> Get(DataSourceLoadOptions loadOptions)
        {
            try
            {
                var    vrsteHomologacije = VrsteHomologacijeDAO.GetAllVrsteHomologacije(0);
                object result            = await Task.Run(() => DataSourceLoader.Load(vrsteHomologacije, loadOptions));

                return(result);
            }
            catch (Exception)
            {
                object result = await Task.Run(() => DataSourceLoader.Load(new List <VrsteHomologacijeModel>(), loadOptions));

                return(result);
            }
        }
        // GET: TypeHomologIS/Edit/5
        public ActionResult Edit()
        {
            try
            {
                if (HttpContext.Session.GetObjectFromJson <KorisnikModel>("LogovaniKorisnik") == null)
                {
                    return(View("~/Views/Login/Index.cshtml"));
                }

                return(View(VrsteHomologacijeDAO.GetHomologisTypeById(Convert.ToInt32(HttpContext.Session.GetInt32("VrstaHomologacijeID")))));
            }
            catch (Exception)
            {
                return(View("Index"));
            }
        }
        public object GetVrsteHomologacijeBySertificate(DataSourceLoadOptions loadOptions)
        {
            var vrsteHomologacije = new List <VrsteHomologacijeModel>();

            try
            {
                GlavnaMasterModel glavnaMaster = GlavnaDAO.GetMasterObjectByUvoznikId(HttpContext.Session.GetObjectFromJson <KorisnikModel>("LogovaniKorisnik").Uvoznik.AutoID);
                HttpContext.Session.SetInt32("GlavnaMasterID", glavnaMaster.AutoID);
                vrsteHomologacije = VrsteHomologacijeDAO.GetAllVrsteHomologacijeFromGlavna(Convert.ToInt32(HttpContext.Session.GetInt32("GlavnaMasterID")));
            }
            catch
            {
            }

            return(DataSourceLoader.Load(vrsteHomologacije, loadOptions));
        }
        public ActionResult Create(VrsteHomologacijeModel vrsteHomologacijeModel)
        {
            try
            {
                if (HttpContext.Session.GetObjectFromJson <KorisnikModel>("LogovaniKorisnik") == null)
                {
                    return(View("~/Views/Login/Index.cshtml"));
                }
                VrsteHomologacijeDAO.CreateNewHomologisType(vrsteHomologacijeModel);

                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception e)
            {
                return(View());
            }
        }
        public ActionResult SaveEdit(VrsteHomologacijeModel vrstaHomologacije)
        {
            try
            {
                if (HttpContext.Session.GetObjectFromJson <KorisnikModel>("LogovaniKorisnik") == null)
                {
                    return(View("~/Views/Login/Index.cshtml"));
                }
                vrstaHomologacije.Id = Convert.ToInt32(HttpContext.Session.GetInt32("VrstaHomologacijeID"));
                VrsteHomologacijeDAO.UpdateHomologisType(vrstaHomologacije);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
        public async Task <object> GetDetail(DataSourceLoadOptions loadOptions)
        {
            try
            {
                var vrsteHomologacije = VrsteHomologacijeDAO.GetAllVrsteHomologacije(1);
                foreach (var item in vrsteHomologacije)
                {
                    item.AtributSet = VrsteHomologacijeDAO.GetAtributSet(item.Id);
                }
                object result = await Task.Run(() => DataSourceLoader.Load(vrsteHomologacije, loadOptions));

                return(result);
            }
            catch (Exception)
            {
                object result = await Task.Run(() => DataSourceLoader.Load(new List <VrsteHomologacijeModel>(), loadOptions));

                return(result);
            }
        }