public async Task <IActionResult> GetMaterialById([FromRoute] long materialID) { try { var material = await _repositoryWrapper.Material.GetMaterialById(materialID); MonitoringPricesService.VerifyPricesMaterial(_repositoryWrapper, material); return(material != null ? Ok(material) : StatusCode(404, new { message = "Could not GET the material with given ID." })); } catch (Exception ex) { return(StatusCode(500, "Internal server error " + ex)); } }
public async Task <IActionResult> GetFinishById([FromRoute] long finishID) { try { var finish = await _repositoryWrapper.Finish.GetFinishById(finishID); MonitoringPricesService.VerifyPricesFinish(_repositoryWrapper, finish); return(finish != null ? Ok(finish) : StatusCode(404, new { message = "Could not GET the finish with given ID." })); } catch (Exception ex) { return(StatusCode(500, "Internal server error " + ex)); } }
public async Task <IActionResult> GetAllMaterials() { try { var materials = await _repositoryWrapper.Material.GetAllMaterials(); MonitoringPricesService.VerifyPricesOfMaterials(_repositoryWrapper, materials); return(materials != null ? Ok(materials) : StatusCode(404, new { message = "Internal error: Could not GET database materials." })); } catch (Exception ex) { return(StatusCode(500, "Internal server error " + ex)); } }