public DbExpenseReport SaveExpenseReport(DbExpenseReport report)
 {
     using (var context = new ExpensesContext())
     {
         if (report.ExpenseReportId != 0)
         {
             context.Reports.Attach(report);
             context.Entry <DbExpenseReport>(report).State = System.Data.Entity.EntityState.Modified;
         }
         else
         {
             context.Reports.Add(report);
         }
         context.SaveChanges();
         return(report);
     }
 }
        public DbEmployee SaveEmployee(DbEmployee employee)
        {
            using (var context = new ExpensesContext())
            {
                if (employee.EmployeeId != 0)
                {
                    context.Employees.Attach(employee);
                    context.Entry <DbEmployee>(employee).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    context.Employees.Add(employee);
                }

                context.SaveChanges();
                return(employee);
            }
        }
        public DbCharge SaveCharge(DbCharge charge)
        {
            using (var context = new ExpensesContext())
            {
                if (charge.ChargeId != 0)
                {
                    context.Charges.Attach(charge);
                    context.Entry <DbCharge>(charge).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    context.Charges.Add(charge);
                }

                context.SaveChanges();
                return(charge);
            }
        }
        public DbCharge SaveCharge(DbCharge charge)
        {
            using (var context = new ExpensesContext())
            {
                if (charge.ChargeId != 0)
                {
                    context.Charges.Attach(charge);
                    context.Entry<DbCharge>(charge).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    context.Charges.Add(charge);
                }

                context.SaveChanges();
                return charge;
            }
        }
 public DbExpenseReport SaveExpenseReport(DbExpenseReport report)
 {
     using (var context = new ExpensesContext())
     {
         if (report.ExpenseReportId != 0)
         {
             context.Reports.Attach(report);
             context.Entry<DbExpenseReport>(report).State = System.Data.Entity.EntityState.Modified;
         }
         else
         {
             context.Reports.Add(report);
         }
         context.SaveChanges();
         return report;
     }
 }
        public DbEmployee SaveEmployee(DbEmployee employee)
        {
            using (var context = new ExpensesContext())
            {
                if (employee.EmployeeId != 0)
                {
                    context.Employees.Attach(employee);
                    context.Entry<DbEmployee>(employee).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    context.Employees.Add(employee);
                }

                context.SaveChanges();
                return employee;
            }
        }