public bool Delete(CustomPropertyViewModel dt, int id) { CustomProperty dr = db.CustomProperties.Where(i => i.cpID == id).FirstOrDefault(); db.CustomProperties.Remove(dr); var Result = db.SaveChanges(); return(Result == 1); }
public bool Update(CustomPropertyViewModel dt, int id) { CustomProperty dr = db.CustomProperties.Where(i => i.cpID == id).FirstOrDefault(); dr.cpID = dt.ID; dr.cpTableID = dt.TableID; dr.cpTableName = dt.TableName; dr.cpName = dt.PropertyName; dr.cpValue = dt.PropertyValue; var Result = db.SaveChanges(); return(Result == 1); }
public int Insert(CustomPropertyViewModel dt) { CustomProperty dr = new CustomProperty(); dr.cpTableID = dt.TableID; dr.cpTableName = dt.TableName; dr.cpName = dt.PropertyName; dr.cpValue = dt.PropertyValue; db.CustomProperties.Add(dr); var Result = db.SaveChanges(); return(dr.cpID); }