Example #1
0
 public void RowDelete(int key)
 {
     try
     {
         GradDAO.DeleteCity(key);
     }
     catch (Exception)
     {
     }
 }
Example #2
0
        // GET: City/Delete/5
        public bool Delete([FromBody] GradModel grad)
        {
            try
            {
                return(GradDAO.DeleteCity(grad.PostanskiBrojID));
            }
            catch (Exception)
            {
            }

            return(false);
        }
Example #3
0
 public ActionResult CreateCityPopup(GradModel grad)
 {
     try
     {
         GradDAO.CreateNewCity(grad);
         return(View("Register"));
     }
     catch (Exception e)
     {
         e.Message.ToString();
         return(View("Register"));
     }
 }
Example #4
0
        public object GetCityHall(DataSourceLoadOptions loadOptions)
        {
            var opstine = new List <OpstinaModel>();

            try
            {
                opstine = GradDAO.GetAllTownships();
            }
            catch (Exception)
            {
            }

            return(DataSourceLoader.Load(opstine, loadOptions));
        }
Example #5
0
        public object Get(DataSourceLoadOptions loadOptions)
        {
            var gradovi = new List <GradModel>();

            try
            {
                gradovi = GradDAO.GetAllCitys();
            }
            catch (Exception)
            {
            }

            return(DataSourceLoader.Load(gradovi, loadOptions));
        }
Example #6
0
        public ActionResult Create(GradModel grad)
        {
            try
            {
                if (HttpContext.Session.GetObjectFromJson <KorisnikModel>("LogovaniKorisnik") == null)
                {
                    return(View("~/Views/Login/Index.cshtml"));
                }
                GradDAO.CreateNewCity(grad);

                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception e)
            {
                return(View());
            }
        }
Example #7
0
        public ActionResult SaveEdit(GradModel grad)
        {
            try
            {
                if (HttpContext.Session.GetObjectFromJson <KorisnikModel>("LogovaniKorisnik") == null)
                {
                    return(View("~/Views/Login/Index.cshtml"));
                }
                grad.PostanskiBrojID = Convert.ToInt32(HttpContext.Session.GetInt32("GradID"));
                GradDAO.UpdateCity(grad);

                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception e)
            {
                return(RedirectToAction(nameof(Edit)));
            }
        }
Example #8
0
        // GET: City/Edit/5
        public ActionResult Edit()
        {
            var grad = new GradModel();

            try
            {
                grad = GradDAO.GetCityById(Convert.ToInt32(HttpContext.Session.GetInt32("GradID")));
                if (HttpContext.Session.GetObjectFromJson <KorisnikModel>("LogovaniKorisnik") == null)
                {
                    return(View("~/Views/Login/Index.cshtml"));
                }
            }
            catch (Exception)
            {
            }


            return(View(grad));
        }
Example #9
0
        public IActionResult RowUpdate(int key, string values)
        {
            try
            {
                GradModel updatedCity = GradDAO.GetCityById(key);
                JsonConvert.PopulateObject(values, updatedCity);

                if (!TryValidateModel(updatedCity))
                {
                    return(BadRequest());
                }

                GradDAO.UpdateCity(updatedCity);
            }
            catch (Exception)
            {
            }

            return(Ok());
        }
Example #10
0
        public IActionResult RowInsert(string values)
        {
            try
            {
                GradModel newCity = new GradModel();
                JsonConvert.PopulateObject(values, newCity);

                if (!TryValidateModel(newCity))
                {
                    return(BadRequest());
                }

                GradDAO.CreateNewCity(newCity);
            }
            catch (Exception)
            {
            }


            return(Ok());
        }