public OperativeSystemM Save(OperativeSystemM OS) { OperativeSystem osDb = new OperativeSystem() { OS = OS.OS, }; osDb = Context.OperativeSystems.Add(osDb); Context.SaveChanges(); OS.Id = osDb.Id; return(OS); }
public OperativeSystemM Delete(int id) { OperativeSystem os = Context.OperativeSystems.SingleOrDefault(x => x.Id == id); Context.OperativeSystems.Remove(os); Context.SaveChanges(); return(new OperativeSystemM() { Id = os.Id, OS = os.OS, }); }
public OperativeSystemM FindById(int id) { OperativeSystem os = Context.OperativeSystems.SingleOrDefault(x => x.Id == id); if (os == null) { return(null); } return(new OperativeSystemM() { Id = os.Id, OS = os.OS }); }