public void DeleteTargetGroup(TargetGroupItem targetGroupItem) { var entity = new TargetGroup { TargetGroupID = targetGroupItem.TargetGroupID }; db.TargetGroups.Attach(entity); db.TargetGroups.Remove(entity); db.SaveChanges(); }
public void CreateTargetGroup(TargetGroupItem targetGroupItem) { var entity = new TargetGroup { TargetGroupName = targetGroupItem.TargetGroupName }; db.TargetGroups.Add(entity); db.SaveChanges(); targetGroupItem.TargetGroupID = entity.TargetGroupID; }
public void UpdateTargetGroup(TargetGroupItem targetGroupItem) { var entity = new TargetGroup { TargetGroupID = targetGroupItem.TargetGroupID, TargetGroupName = targetGroupItem.TargetGroupName }; db.TargetGroups.Attach(entity); db.Entry(entity).State = EntityState.Modified; db.SaveChanges(); }