コード例 #1
0
 public static bool AddIssue(Issue issue)
 {
     try
     {
         using (var db = new IssuesEntities())
         {
             db.Issue.Add(issue);
             db.SaveChanges();
             return true;
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return false;
     }
 }
コード例 #2
0
 public static bool UpdateIssue(IssueAjax issue)
 {
     try
     {
         using (var db = new IssuesEntities())
         {
             var iss = (from i in db.Issue where i.Id == issue.Id select i).Single();
             iss.ModifiedOn = DateTime.Now;
             iss.Title = issue.Title;
             iss.Description = issue.Description;
             iss.Type = issue.TypeId;
             iss.Status = issue.StatusId;
             db.Issue.AddOrUpdate(iss);
             db.SaveChanges();
             return true;
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return false;
     }
 }
コード例 #3
0
 public static bool RemoveIssue(int id)
 {
     using (var db = new IssuesEntities())
     {
         try
         {
             var forremove = (from i in db.Issue where i.Id == id select i).Single();
             db.Issue.Remove(forremove);
             db.SaveChanges();
             return true;
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
             return false;
         }
     }
 }