public IActionResult Delete(int id) { var drzava = db.Drzava.Where(d => d.Id == id).SingleOrDefault(); if (drzava == null) { return(HttpNotFound()); } db.Drzava.Remove(drzava); db.SaveChanges(); return(new HttpOkResult()); }
public IActionResult Delete(int id) { var mesto = db.Mesto.Where(m => m.Id == id).SingleOrDefault(); if (mesto == null) { return(HttpNotFound()); } db.Mesto.Remove(mesto); db.SaveChanges(); return(new HttpOkResult()); }
public IActionResult Login([FromBody] Korisnik login) { var korisnik = db.Korisnik.Where(k => k.Username == login.Username && k.Password == login.Password).SingleOrDefault(); if (korisnik == null) { Response.StatusCode = 401; //401 - unauthorized return(null); } else { korisnik.Guid = Guid.NewGuid().ToString(); db.SaveChanges(); return(new HttpOkObjectResult(korisnik)); } }
public IActionResult Delete(int id, string guid) { if (IsLoggedIn(guid) == null) { Response.StatusCode = 401; //401 - unauthorized return(null); } else { var o = db.Kontakt .Single(os => os.Id == id); db.Remove(o); db.SaveChanges(); return(new HttpOkResult()); } }