internal void delete(FuneralCompany funeralCompany) { using (ApplicationDbContext dbContext = new ApplicationDbContext()) { new FuneralCompanyRepository(dbContext).delete(funeralCompany); dbContext.SaveChanges(); } }
public void update(FuneralCompany funeralCompany) { try { using (ApplicationDbContext dbContext = new ApplicationDbContext()) { new FuneralCompanyRepository(dbContext).update(funeralCompany); dbContext.SaveChanges(); } } catch (Exception ex) { } }
public FuneralCompany create(FuneralCompany funeralCompany) { try { using (ApplicationDbContext dbContext = new ApplicationDbContext()) { new FuneralCompanyRepository(dbContext).create(funeralCompany); dbContext.SaveChanges(); return(funeralCompany); } } catch (Exception ex) { } return(null); }
public FuneralCompany getByID(String id) { try { FuneralCompany funeralCompany = null; using (ApplicationDbContext dbContext = new ApplicationDbContext()) { funeralCompany = new FuneralCompanyRepository(dbContext).getByID(id.ToString()); } return(funeralCompany); } catch (Exception ex) { } return(null); }
private void saveFuneralCompanyInfo() { FuneralCompany funeralCompany = null; if (IsCreateMode) { funeralCompany = new FuneralCompany(); funeralCompany.FuneralCompanyID = Guid.NewGuid(); funeralCompany.Address = new Address(); funeralCompany.Address.CustomAddressID = Guid.NewGuid(); funeralCompany.AddressID = funeralCompany.Address.CustomAddressID; } else { funeralCompany = new FuneralCompanyService().getByID(FuneralCompanyID); } funeralCompany.Name = txtName.Text; funeralCompany.LicenseNumber = txtLicenseNumber.Text; funeralCompany.Address.Street = txtStreet.Text; funeralCompany.Address.HouseNumber = txtHouseNumber.Text; funeralCompany.Address.FlatNumber = txtFlatNumber.Text; funeralCompany.Address.Town = txtTown.Text; funeralCompany.Address.PostCode = txtPostCode.Text; funeralCompany.Address.PhoneNumber = txtPhoneNumber.Text; if (IsCreateMode) { new FuneralCompanyService().create(funeralCompany); Response.Redirect(string.Format("/Pages/FuneralCompanyDetails?FuneralCompanyID={0}", funeralCompany.FuneralCompanyID.ToString())); } else { new FuneralCompanyService().update(funeralCompany); } }