public void Destroy(AchievementsViewModel db) { var entity = new Achievements_Table(); entity.AchievementID = db.AchievementID; entities.Achievements_Table.Attach(entity); entities.Achievements_Table.Remove(entity); entities.SaveChanges(); }
public void Update(AchievementsViewModel db) { var entity = new Achievements_Table(); entity.AchievementID = db.AchievementID; entity.AchievementsDate = (DateTime)db.AchievementsDate.Date; entity.AchievementsName = db.AchievementsName; entity.AchievementsAbstract = HttpUtility.HtmlDecode(db.AchievementsAbstract); entity.url = db.url; entity.ProjectID = db.ProjectID; entity.UserID = db.UserID; entities.Achievements_Table.Attach(entity); entities.Entry(entity).State = EntityState.Modified; entities.SaveChanges(); }
public void Create(AchievementsViewModel db) { var entity = new Achievements_Table(); entity.AchievementsDate = (DateTime)db.AchievementsDate.Date; entity.AchievementsName = db.AchievementsName; entity.AchievementsAbstract = HttpUtility.HtmlDecode(db.AchievementsAbstract); entity.url = db.url; entity.ProjectID = db.ProjectID; entity.UserID = db.UserID; entities.Achievements_Table.Add(entity); entities.SaveChanges(); db.AchievementID = entity.AchievementID; }