public void Save(Issue issue)
 {
     if (issue.ID == 0)
     {
         Insert(issue);
     }
     else
     {
         Update(issue);
     }
 }
Esempio n. 2
0
 private void toolStripButtonAdd_Click(object sender, EventArgs e)
 {
     Issue issue = new Issue();
     FormAddEditIssue formAddIssue = new FormAddEditIssue(issue);
     if (formAddIssue.ShowDialog() == DialogResult.OK)
     {
         IssuesRepository issuesRepository = new IssuesRepository();
         issuesRepository.Save(issue);
         BindControls();
     }
 }
 private void Update(Issue issue)
 {
     dataBase.Entry(issue).State = EntityState.Modified;
     dataBase.SaveChanges();
 }
 private void Insert(Issue issue)
 {
     dataBase.Issues.Add(issue);
     dataBase.SaveChanges();
 }
 public void Delete(Issue issue)
 {
     dataBase.Entry(issue).State = EntityState.Deleted;
     dataBase.SaveChanges();
 }
 public FormAddEditIssue(Issue issue)
 {
     InitializeComponent();
     this.issue = issue;
 }