public ActionResult fetchCurrentMaterialFinishPrice(long materialId, long finishId, [FromQuery] string currency, [FromQuery] string area) { GetCurrentMaterialFinishPriceModelView fetchCurrentMaterialFinishPrice = new GetCurrentMaterialFinishPriceModelView(); fetchCurrentMaterialFinishPrice.finish = new GetMaterialFinishModelView(); fetchCurrentMaterialFinishPrice.currentPrice = new PriceModelView(); fetchCurrentMaterialFinishPrice.finish.materialId = materialId; fetchCurrentMaterialFinishPrice.finish.id = finishId; fetchCurrentMaterialFinishPrice.currentPrice.currency = currency; fetchCurrentMaterialFinishPrice.currentPrice.area = area; try { GetCurrentMaterialFinishPriceModelView currentMaterialFinishPrice = new core.application.PriceTablesController().fetchCurrentMaterialFinishPrice(fetchCurrentMaterialFinishPrice, clientFactory); return(Ok(currentMaterialFinishPrice)); } catch (ResourceNotFoundException e) { return(NotFound(new SimpleJSONMessageService(e.Message))); } catch (ArgumentException e) { return(BadRequest(new SimpleJSONMessageService(e.Message))); } catch (Exception) { return(StatusCode(500, new SimpleJSONMessageService(UNEXPECTED_ERROR))); } }
public ActionResult fetchMaterialFinishPriceHistory(long materialID, long finishID, [FromQuery] string currency, [FromQuery] string area) { FetchMaterialFinishPriceHistoryDTO fetchMaterialFinishPriceHistoryDTO = new FetchMaterialFinishPriceHistoryDTO(); fetchMaterialFinishPriceHistoryDTO.materialID = materialID; fetchMaterialFinishPriceHistoryDTO.finishID = finishID; fetchMaterialFinishPriceHistoryDTO.currency = currency; fetchMaterialFinishPriceHistoryDTO.area = area; try { GetAllMaterialFinishPriceHistoryModelView materialFinishPriceHistoryModelView = new core.application.PriceTablesController().fetchMaterialFinishPriceHistory(fetchMaterialFinishPriceHistoryDTO, clientFactory); return(Ok(materialFinishPriceHistoryModelView)); } catch (ResourceNotFoundException e) { return(NotFound(new SimpleJSONMessageService(e.Message))); } catch (ArgumentException e) { return(BadRequest(new SimpleJSONMessageService(e.Message))); } catch (Exception) { return(StatusCode(500, new SimpleJSONMessageService(UNEXPECTED_ERROR))); } }
public ActionResult fetchAllMaterialsPriceHistory([FromQuery] string currency, [FromQuery] string area) { try { GetAllMaterialPriceHistoryModelView modelView = new core.application.PriceTablesController().fetchPriceHistoryOfAllMaterials(currency, area, clientFactory); return(Ok(modelView)); } catch (ResourceNotFoundException e) { return(NotFound(new SimpleJSONMessageService(e.Message))); } catch (ArgumentException e) { return(BadRequest(new SimpleJSONMessageService(e.Message))); } catch (Exception) { return(StatusCode(500, new SimpleJSONMessageService(UNEXPECTED_ERROR))); } }
public ActionResult updateFinishPriceTableEntry(long materialid, long finishid, long entryid, [FromBody] UpdateFinishPriceTableEntryModelView modelView) { try { modelView.entityId = materialid; modelView.finishId = finishid; modelView.tableEntryId = entryid; GetMaterialFinishPriceModelView updatedEntry = new core.application.PriceTablesController().updateFinishPriceTableEntry(modelView, clientFactory); if (updatedEntry == null) { return(BadRequest(new { error = ENTRY_NOT_UPDATED })); } return(Ok(updatedEntry)); } catch (ResourceNotFoundException e) { return(NotFound(new SimpleJSONMessageService(e.Message))); } catch (NullReferenceException e) { return(BadRequest(new SimpleJSONMessageService(e.Message))); } catch (InvalidOperationException e) { return(BadRequest(new SimpleJSONMessageService(e.Message))); } catch (UnparsableValueException e) { return(BadRequest(new SimpleJSONMessageService(e.Message))); } catch (ArgumentException e) { return(BadRequest(new SimpleJSONMessageService(e.Message))); } catch (Exception) { return(StatusCode(500, new SimpleJSONMessageService(UNEXPECTED_ERROR))); } }
public ActionResult addFinishPriceTableEntry(long materialid, long finishid, [FromBody] AddFinishPriceTableEntryModelView modelView) { try { modelView.entityId = materialid; modelView.finishId = finishid; GetMaterialFinishPriceModelView createdPrice = new core.application.PriceTablesController().addFinishPriceTableEntry(modelView, clientFactory); if (createdPrice == null) { return(BadRequest(new SimpleJSONMessageService(PRICE_ENTRY_NOT_CREATED))); } return(Created(Request.Path, createdPrice)); } catch (ResourceNotFoundException e) { return(NotFound(new SimpleJSONMessageService(e.Message))); } catch (NullReferenceException e) { return(BadRequest(new SimpleJSONMessageService(e.Message))); } catch (InvalidOperationException e) { return(BadRequest(new SimpleJSONMessageService(e.Message))); } catch (UnparsableValueException e) { return(BadRequest(new SimpleJSONMessageService(e.Message))); } catch (ArgumentException e) { return(BadRequest(new SimpleJSONMessageService(e.Message))); } catch (Exception) { return(StatusCode(500, new SimpleJSONMessageService(UNEXPECTED_ERROR))); } }