Example #1
0
 public void Delete(AddressModel addressModel)
 {
     using (var db = new ApplicationDataContext())
     {
         db.AddressModels.Remove(addressModel);
         db.SaveChanges();
     }
 }
Example #2
0
 public void Insert(AddressModel addressModel)
 {
     using (var db = new ApplicationDataContext())
     {
         db.AddressModels.Add(addressModel);
         db.SaveChanges();
     }
 }
Example #3
0
        public void Update(EmployeeModel employeeModel)
        {
            using (var db = new ApplicationDataContext())
            {
                db.EmployeeModels.Update(employeeModel);

                db.SaveChanges();
            }
        }
Example #4
0
        public EmployeeModel Insert(EmployeeModel model)
        {
            using (var db = new ApplicationDataContext())
            {
                model.Id = Guid.Empty;

                db.EmployeeModels.Add(model);
                db.SaveChanges();

                return(model);
            }
        }
Example #5
0
        public bool Delete(Guid id)
        {
            using (var db = new ApplicationDataContext())
            {
                var empToRemove = db.EmployeeModels.FirstOrDefault(e => e.Id == id);

                if (empToRemove == null)
                {
                    return(false);
                }

                db.EmployeeModels.Remove(empToRemove);
                db.SaveChanges();

                return(true);
            }
        }