public async Task Delete(Address t) { using (_context = CRMContextFactory.getContext()) { _context.Addresses.Remove(t); await _context.SaveChangesAsync(); } }
public async Task Delete(TicketStatus t) { using (_context = CRMContextFactory.getContext()) { _context.TicketStatuses.Remove(t); await _context.SaveChangesAsync(); } }
public async Task Delete(Customer t) { using (_context = CRMContextFactory.getContext()) { _context.Customers.Remove(t); await _context.SaveChangesAsync(); } }
public async Task <TicketHistory> Save(TicketHistory t) { using (_context = CRMContextFactory.getContext()) { _context.TicketHistories.Add(t); await _context.SaveChangesAsync(); return(t); } }
public async Task <Customer> Update(Customer t) { using (_context = CRMContextFactory.getContext()) { var Customers = _context.Customers.Update(t); await _context.SaveChangesAsync(); return(t); } }
public async Task <Country> Save(Country t) { using (_context = CRMContextFactory.getContext()) { _context.Countries.Add(t); await _context.SaveChangesAsync(); return(t); } }
public async Task <Customer> Save(Customer t) { using (_context = CRMContextFactory.getContext()) { _context.Customers.Add(t); await _context.SaveChangesAsync(); return(t); } }
public async Task <Store> Save(Store t) { using (_context = CRMContextFactory.getContext()) { _context.Stores.Add(t); await _context.SaveChangesAsync(); return(t); } }
public async Task <Store> Update(Store t) { using (_context = CRMContextFactory.getContext()) { var Stores = _context.Stores.Update(t); await _context.SaveChangesAsync(); return(t); } }
public async Task <Address> Update(Address t) { using (_context = CRMContextFactory.getContext()) { var address = _context.Addresses.Update(t); await _context.SaveChangesAsync(); return(t); } }
public async Task <Country> Update(Country t) { using (_context = CRMContextFactory.getContext()) { var countries = _context.Countries.Update(t); await _context.SaveChangesAsync(); return(t); } }
public async Task <TicketStatus> Update(TicketStatus t) { using (_context = CRMContextFactory.getContext()) { var TicketStatuses = _context.TicketStatuses.Update(t); await _context.SaveChangesAsync(); return(t); } }
public async Task <Address> Get(Expression <Func <Address, bool> > predicate, string includeProperties = null) { using (_context = CRMContextFactory.getContext()) { if (includeProperties != null) { return(await _context.Addresses.Include(includeProperties).FirstOrDefaultAsync(predicate)); } else { return(await _context.Addresses.FirstOrDefaultAsync(predicate)); } } }
public async Task <IList <Address> > GetList(Expression <Func <Address, bool> > predicate, string includeProperties = null) { using (_context = CRMContextFactory.getContext()) { if (includeProperties != null) { return(await _context.Addresses.Include(includeProperties).Where(predicate).ToListAsync()); } else { return(await _context.Addresses.Where(predicate).ToListAsync()); } } }
public async Task <Ticket> Update(Ticket t, Staff s) { using (_context = CRMContextFactory.getContext()) { _context.Update(t); var history = new TicketHistory(); history.idStaffAssigned = t.idStaffAssignedTo; history.idTicket = t.idTicket; history.idTicketStatus = t.idTicketStatus; history.dtChanged = DateTime.Now; history.idStaffAssigns = s.idStaff; _context.TicketHistories.Add(history); await _context.SaveChangesAsync(); return(t); } }
public async Task <Customer> Get(Expression <Func <Customer, bool> > predicate, string includeProperties = null) { using (_context = CRMContextFactory.getContext()) { if (includeProperties != null) { var custs = _context.Customers.AsQueryable(); foreach (string inc in getProperties(includeProperties)) { custs = custs.Include(inc); } return(await custs.FirstOrDefaultAsync(predicate)); } else { return(await _context.Customers.Include(s => s.Address).FirstOrDefaultAsync(predicate)); } } }
public async Task <TicketHistory> Get(Expression <Func <TicketHistory, bool> > predicate, string includeProperties = null) { using (_context = CRMContextFactory.getContext()) { if (includeProperties != null) { var histories = _context.TicketHistories.AsQueryable(); foreach (string inc in getProperties(includeProperties)) { histories = histories.Include(inc); } return(await histories.FirstOrDefaultAsync(predicate)); } else { return(await _context.TicketHistories.FirstOrDefaultAsync(predicate)); } } }
public async Task <IList <Ticket> > GetList(Expression <Func <Ticket, bool> > predicate, string includeProperties = null) { using (_context = CRMContextFactory.getContext()) { if (includeProperties != null) { var tickets = _context.Tickets.AsQueryable(); foreach (string inc in getProperties(includeProperties)) { tickets = tickets.Include(inc); } return(await tickets.Where(predicate).ToListAsync()); } else { return(await _context.Tickets.Where(predicate).ToListAsync()); } } }
public async Task <IList <Store> > GetList(Expression <Func <Store, bool> > predicate, string includeProperties = null) { using (_context = CRMContextFactory.getContext()) { if (includeProperties != null) { var stores = _context.Stores.AsQueryable(); foreach (string inc in getProperties(includeProperties)) { stores = stores.Include(inc); } return(await stores.ToListAsync()); } else { return(await _context.Stores.Include(s => s.Address).Where(predicate).ToListAsync()); } } }