Beispiel #1
0
 public InsertResponse Post([FromBody] Ac4yPersistentChild ac4yPersistentChild)
 {
     return(new Ac4yPersistentChildEFService().Insert(new InsertRequest()
     {
         Ac4yPersistentChild = ac4yPersistentChild
     }));
 }
        } // UpdateByGuid

        public void DeleteById(int id)
        {
            var context = new Context();

            Ac4yPersistentChild actual = context.Ac4yPersistentChilds.Find(id);

            context.Ac4yPersistentChilds.Remove(actual);
            context.SaveChanges();
        } // DeleteById
Beispiel #3
0
    {/*
      * public void InsertKepernyo(Kepernyo kepernyo)
      * {
      *
      *     using (var context = new Context())
      *     {
      *         context.Database.EnsureCreated();
      *
      *         context.Keprnyos.Add(kepernyo);
      *         context.SaveChanges();
      *     }
      *
      * } // Insert
      *
      * public void InsertProgramKod(Programkod programkod)
      * {
      *
      *     using (var context = new Context())
      *     {
      *         context.Database.EnsureCreated();
      *
      *         context.Programkods.Add(programkod);
      *         context.SaveChanges();
      *     }
      *
      * } // Insert*/
        public void InsertAc4yPersistentChild(Ac4yPersistentChild ac4yPersistentChild)
        {
            using (var context = new Context())
            {
                context.Database.EnsureCreated();

                context.Ac4yPersistentChilds.Add(ac4yPersistentChild);
                context.SaveChanges();
            }
        } // Insert
        } // UpdateById

        public void UpdateByGuid(string guid, Ac4yPersistentChild ac4yPersistentChild)
        {
            using (var context = new Context())
            {
                Ac4yPersistentChild actual = context.Ac4yPersistentChilds.Where(entity => entity.GUID == guid).FirstOrDefault <Ac4yPersistentChild>();
                int id = actual.Id;
                new Ac4yUtility().Object2Object(ac4yPersistentChild, actual);
                actual.Id   = id;
                actual.GUID = guid;
                context.SaveChanges();
            }
        } // UpdateByGuid
        } // GetList

        public void Insert(Ac4yPersistentChild ac4yPersistentChild)
        {
            using (var context = new Context())
            {
                context.Database.EnsureCreated();

                ac4yPersistentChild.createdAt = DateTime.Now;
                ac4yPersistentChild.updatedAt = DateTime.Now;
                context.Ac4yPersistentChilds.Add(ac4yPersistentChild);
                context.SaveChanges();
            }
        } // Insert
        } // IsExistByGuid

        public void UpdateById(int id, Ac4yPersistentChild ac4yPersistentChild)
        {
            using (var context = new Context())
            {
                Ac4yPersistentChild actual = context.Ac4yPersistentChilds.Find(id);

                ac4yPersistentChild.updatedAt = DateTime.Now;
                ac4yPersistentChild.createdAt = actual.createdAt;

                new Ac4yUtility().Object2Object(ac4yPersistentChild, actual);
                context.SaveChanges();
            }
        } // UpdateById
Beispiel #7
0
 public InsertResponse Post([FromBody] Ac4yPersistentChild newObject)
 {
     return new Ac4yPersistentChildEFService().Insert(new InsertRequest() { Ac4yPersistentChild = newObject });
 }