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