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

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

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

                return(model);
            }
        }
Beispiel #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);
            }
        }
Beispiel #6
0
 public EmployeeModel Get(Guid id)
 {
     using (var db = new ApplicationDataContext())
         return(db.EmployeeModels.FirstOrDefault(e => e.Id == id));
 }
Beispiel #7
0
 public List <EmployeeModel> Get()
 {
     using (var db = new ApplicationDataContext())
         return(db.EmployeeModels.ToList());
 }