public static void DodajTehnickoLice(TehnickoLiceView t) { try { ISession s = DataLayer.GetSession(); var tehnicko = new TehnickoLice(); tehnicko.Ime = t.Ime; tehnicko.Prezime = t.Prezime; tehnicko.KontaktBr = t.KontaktBr; s.Save(tehnicko); s.Flush(); s.Close(); } catch (Exception e) { Console.WriteLine(e); throw; } }
public IActionResult DodajTehnickoLice([FromBody] TehnickoLiceView tehnicko, int id) { try { DataProvider.DodajTehnickoLice(tehnicko); return(Ok()); } catch (Exception e) { return(BadRequest(e.Message)); } }
public static TehnickoLiceView VratiTehnickoLice(int id) { try { ISession s = DataLayer.GetSession(); var t = s.Get <TehnickoLice>(id); var tehnicko = new TehnickoLiceView(t); tehnicko.ZaduzenZa = t.ZaduzenZa.Select(i => new ZaduzenView(i)).ToList(); return(tehnicko); } catch (Exception e) { Console.WriteLine(e); throw; } }