public ProducerDTO Add(ProducerDTO x) { var obj = x.toModel(); try { db.Producers.Add(obj); db.SaveChanges(); } catch { return(null); } return(new ProducerDTO(obj)); }
public ProducerDTO Update(ProducerDTO x) { var a = db.Producers.Find(x.ID); if (a != null) { try { a = x.toModel(); db.SaveChanges(); } catch { return(null); } return(new ProducerDTO(a)); } return(null); }