public void Destroy(MediaViewControl db) { var entity = new Media_Table(); entity.MediaID = db.MediaID; entities.Media_Table.Attach(entity); entities.Media_Table.Remove(entity); entities.SaveChanges(); }
public void Create(MediaViewControl db) { var entity = new Media_Table(); entity.MediaName = db.MediaName; entity.MediaDate = (DateTime)db.MediaDate.Date; entity.PartnerName = db.PartnerName; entity.MediaNumber = db.MediaNumber; entity.minutes = db.minutes; entity.url = db.url; entity.UserID = db.UserID; entity.MediaTypeID = db.MediaTypeID; entity.ProjectID = db.ProjectID; entities.Media_Table.Add(entity); entities.SaveChanges(); db.MediaID = entity.MediaID; }
public void Update(MediaViewControl db) { var entity = new Media_Table(); entity.MediaID = db.MediaID; entity.MediaName = db.MediaName; entity.MediaDate = (DateTime)db.MediaDate.Date; entity.PartnerName = db.PartnerName; entity.MediaNumber = db.MediaNumber; entity.minutes = db.minutes; entity.url = db.url; entity.UserID = db.UserID; entity.MediaTypeID = db.MediaTypeID; entity.ProjectID = db.ProjectID; entities.Media_Table.Attach(entity); entities.Entry(entity).State = EntityState.Modified; entities.SaveChanges(); }