public void RowDelete(int key) { try { GradDAO.DeleteCity(key); } catch (Exception) { } }
// GET: City/Delete/5 public bool Delete([FromBody] GradModel grad) { try { return(GradDAO.DeleteCity(grad.PostanskiBrojID)); } catch (Exception) { } return(false); }
public ActionResult CreateCityPopup(GradModel grad) { try { GradDAO.CreateNewCity(grad); return(View("Register")); } catch (Exception e) { e.Message.ToString(); return(View("Register")); } }
public object GetCityHall(DataSourceLoadOptions loadOptions) { var opstine = new List <OpstinaModel>(); try { opstine = GradDAO.GetAllTownships(); } catch (Exception) { } return(DataSourceLoader.Load(opstine, loadOptions)); }
public object Get(DataSourceLoadOptions loadOptions) { var gradovi = new List <GradModel>(); try { gradovi = GradDAO.GetAllCitys(); } catch (Exception) { } return(DataSourceLoader.Load(gradovi, loadOptions)); }
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 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))); } }
// 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)); }
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()); }
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()); }