Exemplo n.º 1
0
        public bool Delete(AddressEntityViewModel dt, int id)
        {
            AddressEntity dr = db.AddressEntities.Where(i => i.aeID == id).FirstOrDefault();

            db.AddressEntities.Remove(dr);

            var Result = db.SaveChanges();

            return(Result == 1);
        }
Exemplo n.º 2
0
        public int Insert(AddressEntityViewModel dt)
        {
            AddressEntity dr = new AddressEntity();

            dr.aeTableID     = dt.TableID;
            dr.aeTableName   = dt.TableName;
            dr.aeAddressID   = dt.AddressID;
            dr.aeAddressType = dt.AddressType;
            db.AddressEntities.Add(dr);
            var Result = db.SaveChanges();

            return(dr.aeAddressID);
        }
Exemplo n.º 3
0
        public bool Update(AddressEntityViewModel dt, int id)
        {
            AddressEntity dr = db.AddressEntities.Where(i => i.aeID == id).FirstOrDefault();

            dr.aeID          = dt.ID;
            dr.aeTableID     = dt.TableID;
            dr.aeTableName   = dt.TableName;
            dr.aeAddressID   = dt.AddressID;
            dr.aeAddressType = dt.AddressType;
            db.AddressEntities.Add(dr);
            var Result = db.SaveChanges();

            return(Result == 1);
        }