Exemplo n.º 1
0
 /// <summary>
 /// Deletes recent project by path
 /// </summary>
 /// <param name="path">Path.</param>
 public static void Delete(string path)
 {
     using (RecentProjectsContext db = new RecentProjectsContext())
     {
         Repository.Entities.RecentProject p = db.RecentProjects.FirstOrDefault(x => x.Path.Equals(path));
         if (p != null)
         {
             db.RecentProjects.Remove(p);
             db.SaveChanges();
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Saving recent project to database
 /// </summary>
 public void AddOrUpdate()
 {
     using (RecentProjectsContext db = new RecentProjectsContext())
     {
         Repository.Entities.RecentProject p = db.RecentProjects.FirstOrDefault(x => x.Path.Equals(Path));
         if (p == null)
         {
             db.RecentProjects.Add(new Repository.Entities.RecentProject
             {
                 Name           = Name,
                 Path           = Path,
                 LastAccessDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
             });
         }
         else
         {
             p.LastAccessDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
         }
         db.SaveChanges();
     }
 }