public async Task <IList <Transaction> > FarmReportFoodOut(int premisesId) { int month = DateTime.Now.Month; var result = await _transactionRepos.FindAllAsync(x => x.SenderId == premisesId && x.CreateDate.Month == month && x.StatusId == 3); foreach (var t in result) { t.Food = _productRepos.GetById(t.FoodId); t.Food.Category = _categoryRepos.GetById(t.Food.CategoryId); t.Receiver = _premisesRepos.GetById(t.ReceiverId); } return(result); }
public async Task <string> CreateFood(Entities.Food newFood, int farmId, int createById) { var Premises = _premesisRepository.GetById(farmId); var Cat = _categoryRepository.GetById(newFood.CategoryId); var FoodData = new FoodData() { FoodId = newFood.FoodId, Breed = newFood.Breed, Category = Cat.Name, Farm = _mapper.Map <Farm>(Premises), StartedDate = DateTime.Now }; return(await _service.AddNewFoodData(FoodData, _userRepository.GetById(createById).Username)); }
public async Task <IList <Transaction> > getAllFarmTransaction(int userId) { var transaction = await _transactionRepos.getAllFarmTransaction(userId); foreach (var i in transaction) { i.Sender = _premisesRepos.GetById(i.SenderId); i.Receiver = _premisesRepos.GetById(i.ReceiverId); i.TransactionStatus = _transactionStatusRepos.GetById(i.StatusId); i.Food = _foodRepos.GetById(i.FoodId); i.Food.Category = _categoryRepos.GetById(i.Food.CategoryId); } return(transaction); }