public IActionResult Dodaj(GradoviInsertUpdate grad) { if (User.Identity.Name != "*****@*****.**" && User.Identity.Name != "*****@*****.**") { return(VratiNijeAutorizovan()); } if (!ModelState.IsValid) { return(View(grad)); } try { if (gradoviServis.Add(grad) != null) { return(Redirect("/Grad")); } } catch (UserException exc) { foreach ((string key, string msg)x in exc.Errori) { ModelState.AddModelError(x.key, x.msg); } } return(View(grad)); }
public Gradovi Add(GradoviInsertUpdate obj) { gradoviAutorizator.AuthorizeAdd(usersService.GetRequestUserName(HttpContext.Request)); return(gradoviService.Add(obj)); }