public List <Category> GetCategories(int companyId) { using var context = new FirmaTakipContext(); return(context.Companies.Join (context.CompanyCategories, company => company.CompanyId, companyCategory => companyCategory.CompanyId, (c, cc) => new { company = c, companyCategory = cc }).Join(context.Categories, iki => iki.companyCategory.CategoryId, category => category.Id, (cc, c) => new { company = cc.company, category = c, companyCategory = cc.companyCategory }).Where(I => I.company.CompanyId == companyId) .Select(I => new Category { Name = I.category.Name, Id = I.category.Id }).ToList()); }
public T GetwithId(int id) { using var context = new FirmaTakipContext(); return(context.Set <T>().Find(id)); }
public List <T> GetAll() { using var context = new FirmaTakipContext(); return(context.Set <T>().ToList()); }
public void Delete(T tablo) { using var context = new FirmaTakipContext(); context.Set <T>().Remove(tablo); context.SaveChanges(); }
public void Update(T tablo) { using var context = new FirmaTakipContext(); context.Set <T>().Update(tablo); context.SaveChanges(); }