Exemplo n.º 1
0
 public void Save(Worklog worklog)
 {
     if (worklog.ID == 0)
     {
         Insert(worklog);
     }
     else
     {
         Update(worklog);
     }
 }
Exemplo n.º 2
0
        private void toolStripButtonAdd_Click(object sender, EventArgs e)
        {
            Worklog worklog = new Worklog();
            FormAddEditWorklogs formAddWorklog = new FormAddEditWorklogs(worklog);

            if (formAddWorklog.ShowDialog() == DialogResult.OK)
            {
                WorklogsRepository worklogsRepository = new WorklogsRepository();
                worklogsRepository.Save(worklog);

                BindControls();
            }
        }
Exemplo n.º 3
0
 private void Update(Worklog worklog)
 {
     dataBase.Entry(worklog).State = EntityState.Modified;
     dataBase.SaveChanges();
 }
Exemplo n.º 4
0
 private void Insert(Worklog worklog)
 {
     dataBase.Worklogs.Add(worklog);
     dataBase.SaveChanges();
 }
Exemplo n.º 5
0
 public void Delete(Worklog worklog)
 {
     dataBase.Entry(worklog).State = EntityState.Deleted;
     dataBase.SaveChanges();
 }