public void Insert(Group group) { try { using (AssociationDbContext context = new AssociationDbContext()) { context.Groups.Add(group); context.SaveChanges(); }; } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { foreach (var ve in eve.ValidationErrors) { } } throw; } catch { throw; } }
public void Delete(Location location) { using (AssociationDbContext context = new AssociationDbContext()) { context.Entry(location).State = EntityState.Deleted; context.SaveChanges(); } }
public void Delete(Group group) { using (AssociationDbContext context = new AssociationDbContext()) { context.Entry(group).State = EntityState.Deleted; context.SaveChanges(); } }
public void Delete(FixedAsset fixedAsset) { using (AssociationDbContext context = new AssociationDbContext()) { context.Entry(fixedAsset).State = EntityState.Deleted; context.SaveChanges(); } }
public void Delete(Barcode barcode) { using (AssociationDbContext context = new AssociationDbContext()) { context.Entry(barcode).State = EntityState.Deleted; context.SaveChanges(); } }
public IEnumerable <FixedAsset> Gets(Expression <Func <FixedAsset, bool> > predicate) { List <FixedAsset> list = new List <FixedAsset>(); using (AssociationDbContext context = new AssociationDbContext()) { list = context.FixedAssets.AsExpandable().Where(predicate).ToList(); } return(list); }
public IEnumerable <FixedAsset> GetAll() { List <FixedAsset> list = new List <FixedAsset>(); using (AssociationDbContext context = new AssociationDbContext()) { list = context.FixedAssets.ToList(); } return(list); throw new NotImplementedException(); }
public IEnumerable <Group> GetAll() { List <Group> list = new List <Group>(); using (AssociationDbContext context = new AssociationDbContext()) { list = context.Groups.ToList(); } return(list); throw new NotImplementedException(); }
public IEnumerable <Group> Gets(Expression <Func <Group, bool> > predicate) { List <Group> list = new List <Group>(); using (AssociationDbContext context = new AssociationDbContext()) { list = context.Groups.AsExpandable().Where(predicate).ToList(); } return(list); }
public void Create(Group group) { try { using (AssociationDbContext context = new AssociationDbContext()) { context.Groups.Add(group); context.SaveChanges(); }; } catch { throw; } }
public IEnumerable <Location> Gets(Expression <Func <Location, bool> > predicate) { List <Location> list = new List <Location>(); using (AssociationDbContext context = new AssociationDbContext()) { list = context.Locations.AsExpandable().Where(predicate).ToList(); list.ForEach(location => { if (Get(x => x.ParentId == location.Id) != null) { location.HasChild = true; } }); } return(list); }
public FixedAsset Get(Expression <Func <FixedAsset, bool> > predicate) { FixedAsset fixedAsset = null; try { using (AssociationDbContext context = new AssociationDbContext()) { fixedAsset = context.FixedAssets.Where(predicate).FirstOrDefault(); } } catch { throw; } return(fixedAsset); }
public Group Get(Expression <Func <Group, bool> > predicate) { Group group = null; try { using (AssociationDbContext context = new AssociationDbContext()) { group = context.Groups.Where(predicate).FirstOrDefault(); } } catch { throw; } return(group); }
public Barcode Get(Expression <Func <Barcode, bool> > predicate) { Barcode barcode = null; try { using (AssociationDbContext context = new AssociationDbContext()) { barcode = context.Barcodes.Where(predicate).FirstOrDefault(); } } catch { throw; } return(barcode); }
public Location Get(Expression <Func <Location, bool> > predicate) { Location location = null; try { using (AssociationDbContext context = new AssociationDbContext()) { location = context.Locations.Where(predicate).FirstOrDefault(); } } catch { throw; } return(location); }
public void Update(Barcode barcode) { try { using (AssociationDbContext context = new AssociationDbContext()) { if (context.Entry(barcode).State == EntityState.Detached) { context.Set <Barcode>().Attach(barcode); } context.Entry(barcode).State = EntityState.Modified; context.SaveChanges(); } } catch { throw; } }
public void Update(FixedAsset fixedAsset) { try { using (AssociationDbContext context = new AssociationDbContext()) { if (context.Entry(fixedAsset).State == EntityState.Detached) { context.Set <FixedAsset>().Attach(fixedAsset); } context.Entry(fixedAsset).State = EntityState.Modified; context.SaveChanges(); } } catch { throw; } }
public void Updatee(Location location) { try { using (AssociationDbContext context = new AssociationDbContext()) { if (context.Entry(location).State == EntityState.Detached) { context.Set <Location>().Attach(location); } context.Entry(location).State = EntityState.Modified; context.SaveChanges(); } } catch { throw; } }
public void Update(Group group) { try { using (AssociationDbContext context = new AssociationDbContext()) { if (context.Entry(group).State == EntityState.Detached) { context.Set <Group>().Attach(group); } context.Entry(group).State = EntityState.Modified; context.SaveChanges(); } } catch { throw; } }
public CompaniesController(AssociationDbContext context, CompanyService companyService) { _context = context; _companyService = companyService; }
public AssociationService(AssociationDbContext context) { _context = context; }
public CompanyService(AssociationDbContext context) { _context = context; }
public AssociatedsController(AssociationDbContext context, AssociatedService associatedService) { _context = context; _associatedService = associatedService; }