public async Task <IActionResult> GetStatusesByEntityType(string entityType) { var results = await StatusActor.Ask( new AskForStatusesByEntity(entityType), TimeSpan.FromSeconds(15) ); return(Ok(FarmForgeApiResponse.Success(results))); }
public async Task <IActionResult> GetClassifications() { var result = await CropClassificationActor.Ask( new AskForCropClassifications(), TimeSpan.FromSeconds(15) ); return(Ok(FarmForgeApiResponse.Success(result))); }
public async Task <IActionResult> ConsumeInventory([FromBody] ConsumeInventoryDTO consumedInventory) { var result = await ProductActor.Ask( new AskToConsumeInventory(consumedInventory.ProductIds), TimeSpan.FromSeconds(15) ); return(Ok(FarmForgeApiResponse.Success(result))); }
public async Task <IActionResult> GetCropLogs(string type) { var result = await CropLogActor.Ask( new AskForCropLogs(type), TimeSpan.FromSeconds(15) ); return(Ok(FarmForgeApiResponse.Success(result))); }
public async Task <IActionResult> GetCropTypes(string includes = null) { var result = await CropTypeActor.Ask( new AskForCropTypes(includes), TimeSpan.FromSeconds(15) ); return(Ok(FarmForgeApiResponse.Success(result))); }
public async Task <IActionResult> GetCurrentInventory() { var result = await ProductActor.Ask( new AskForInventory(), TimeSpan.FromSeconds(15) ); return(Ok(FarmForgeApiResponse.Success(result))); }
public async Task <IActionResult> GetSupplierProducts(int supplierId) { var result = await SupplierActor.Ask( new AskForSupplierProducts(supplierId), TimeSpan.FromSeconds(15) ); return(Ok(FarmForgeApiResponse.Success(result))); }
public async Task <IActionResult> GetSuppliers(string includes) { var result = await SupplierActor.Ask( new AskForSuppliers(includes), TimeSpan.FromSeconds(15) ); return(Ok(FarmForgeApiResponse.Success(result))); }
public async Task <IActionResult> GetUsers() { var result = await AuthActor.Ask( new AskForUsers(), TimeSpan.FromSeconds(15) ); return(Ok(FarmForgeApiResponse.Success(result))); }
public async Task <IActionResult> GetUnitConversionsForUnit(int unitId) { var results = await UnitActor.Ask( new AskForConversionsByUnit(unitId), TimeSpan.FromSeconds(15) ); return(Ok(FarmForgeApiResponse.Success(results))); }
protected IActionResult ValidateActorResult(object result) { var resultType = result.GetType(); if ( resultType == typeof(Exception) || resultType == typeof(UnauthorizedAccessException) || resultType == typeof(InvalidOperationException) ) { var ex = (Exception)result; return(Ok(FarmForgeApiResponse.Failure(ex.Message))); } else { return(Ok(FarmForgeApiResponse.Success(result))); } }