public IGenericResult <ImageSet> FindImageSet(EmptyParameter parameter) { var images = _repository.Images.Untracked .OrderBy(x => Guid.NewGuid()) .Select(x => new { x.Id, x.FileName }) .Take(2) .ToList(); if (images.Count != 2) { return(Result.Fail <ImageSet>(ErrorCode.NoImages)); } else { var first = images[0]; var second = images[1]; return(Result.Value(new ImageSet { First = new ImageFromSet { Id = first.Id, Path = _folder.GetRelativeWebPath(first.FileName) }, Second = new ImageFromSet { Id = second.Id, Path = _folder.GetRelativeWebPath(second.FileName) } })); } }
public async Task <Transaction <IEnumerable <IProduct> > > Execute(EmptyParameter parameter) { var products = await _productsSearcher.GetPendingToBuy(); // usar mapper var iproducts = products.Cast <IProduct>(); var transactionResult = new Transaction <IEnumerable <IProduct> >(iproducts, TransactionResult.Success, string.Empty); return(transactionResult); }
public async Task <Transaction <List <Movie> > > execute(EmptyParameter parameter) { var transaction = new Transaction <List <Movie> >(); try { var favorites = await _favoriteMovieRepository.GetFavoritesMovies(); transaction.Result = favorites; transaction.Status = TransactionStatus.Success; } catch (Exception ex) { transaction.Status = TransactionStatus.Failure; transaction.ErrorMessage = ex.Message; } return(transaction); }
public async Task <Transaction <IEnumerable <IProduct> > > Execute(EmptyParameter parameter) { var products = await _productsSearcher.GetAll(); return(new Transaction <IEnumerable <IProduct> >(products, TransactionResult.Success, string.Empty)); }
public IGenericResult <TestData> Getter(EmptyParameter empty) { throw new Exception(); }
public IVoidResult Exception(EmptyParameter value) { throw new Exception(); }