public void Destroy(AwarenessWorkshopsViewModel db) { var entity = new AwarenessWorkshops_Table(); entity.AwarenessID = db.AwarenessID; entities.AwarenessWorkshops_Table.Attach(entity); entities.AwarenessWorkshops_Table.Remove(entity); entities.SaveChanges(); }
public void Update(AwarenessWorkshopsViewModel db) { var entity = new AwarenessWorkshops_Table(); entity.AwarenessID = db.AwarenessID; entity.AwarenessName = db.AwarenessName; entity.AwarenessDate = (DateTime)db.AwarenessDate.Date; entity.TotalHours = db.TotalHours; entity.TotalBeneficiaries = db.TotalBeneficiaries; entity.Males = db.Males; entity.Females = db.Females; entity.Boy = db.Boy; entity.Girl = db.Girl; entity.UserID = db.UserID; entity.ProjectID = db.ProjectID; entities.AwarenessWorkshops_Table.Attach(entity); entities.Entry(entity).State = EntityState.Modified; entities.SaveChanges(); }
public void Create(AwarenessWorkshopsViewModel db) { var entity = new AwarenessWorkshops_Table(); entity.AwarenessName = db.AwarenessName; entity.AwarenessDate = (DateTime)db.AwarenessDate.Date; entity.TotalBeneficiaries = db.TotalBeneficiaries; entity.TotalHours = db.TotalHours; entity.Males = db.Males; entity.Females = db.Females; entity.Boy = db.Boy; entity.Girl = db.Girl; entity.UserID = db.UserID; entity.ProjectID = db.ProjectID; entities.AwarenessWorkshops_Table.Add(entity); entities.SaveChanges(); db.AwarenessID = entity.AwarenessID; }