示例#1
0
 public async Task <Quote> Find(int id)
 {
     return(await _repository.GetById(id));
 }
示例#2
0
 private static void SetOriginalValue(int entityId, Table t, Field f, Translation translation)
 {
     if (t == Table.Articles)
     {
         IArticleRepository repository = DependencyResolver.Current.GetService <IArticleRepository>();
         Article            item       = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
         if (item != null && f == Field.Description)
         {
             translation.Original = item.Description;
         }
     }
     if (t == Table.Certificates)
     {
         ICertificatesRepository repository = DependencyResolver.Current.GetService <ICertificatesRepository>();
         Certificate             item       = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
     }
     if (t == Table.Contacts)
     {
         IContactsRepository repository = DependencyResolver.Current.GetService <IContactsRepository>();
         Contact             item       = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
         if (item != null && f == Field.Description)
         {
             translation.Original = item.Description;
         }
     }
     if (t == Table.Languages)
     {
         ILanguagesRepository repository = DependencyResolver.Current.GetService <ILanguagesRepository>();
         Language             item       = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
     }
     if (t == Table.PortfolioDetails)
     {
         IPortfolioDetailsRepository repository = DependencyResolver.Current.GetService <IPortfolioDetailsRepository>();
         PortfolioDetail             item       = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
     }
     if (t == Table.Portfolios)
     {
         IPortfoliosRepository repository = DependencyResolver.Current.GetService <IPortfoliosRepository>();
         Portfolio             item       = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
         if (item != null && f == Field.Description)
         {
             translation.Original = item.Description;
         }
     }
     if (t == Table.ProductCategories)
     {
         IProductCategoriesRepository repository = DependencyResolver.Current.GetService <IProductCategoriesRepository>();
         ProductCategory item = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
         if (item != null && f == Field.Description)
         {
             translation.Original = item.Description;
         }
     }
     if (t == Table.Products)
     {
         IProductsRepository repository = DependencyResolver.Current.GetService <IProductsRepository>();
         Product             item       = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
         if (item != null && f == Field.Description)
         {
             translation.Original = item.Description;
         }
     }
     if (t == Table.Quotes)
     {
         IQuotesRepository repository = DependencyResolver.Current.GetService <IQuotesRepository>();
         Quote             item       = repository.GetById(entityId);
         if (item != null && f == Field.Description)
         {
             translation.Original = item.Description;
         }
     }
     if (t == Table.Sliders)
     {
         ISlidersRepository repository = DependencyResolver.Current.GetService <ISlidersRepository>();
         Slider             item       = repository.GetById(entityId);
         if (item != null && f == Field.Name)
         {
             translation.Original = item.Name;
         }
     }
 }