예제 #1
0
 public ActionResult CreateCityPopup(GradModel grad)
 {
     try
     {
         GradDAO.CreateNewCity(grad);
         return(View("Register"));
     }
     catch (Exception e)
     {
         e.Message.ToString();
         return(View("Register"));
     }
 }
예제 #2
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());
            }
        }
예제 #3
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());
        }