コード例 #1
0
        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);
        }
コード例 #2
0
        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,
            });
        }
コード例 #3
0
        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
            });
        }