public IActionResult Post([FromBody] PersoneViewModel value) { if (!ModelState.IsValid) { return(BadRequest()); } _hibernateRepository.Add(value); return(Ok()); }
public void Add(PersoneViewModel persone) { try { _personeContext.persones.Add(new Persone { Iin = persone.Iin, FirstName = persone.FirstName, LastName = persone.LastName, BirthDate = persone.BirthDate }); _personeContext.SaveChanges(); } catch (Exception ex) { Debug.WriteLine(ex); } }
public void Add(PersoneViewModel value) { using (var transaction = _session.BeginTransaction()) { try { _session.Save(new Persone { Iin = value.Iin, FirstName = value.FirstName, LastName = value.LastName, BirthDate = value.BirthDate }); transaction.Commit(); } catch (Exception ex) { Debug.WriteLine(ex); } } }