public ActionResult updateCommercialCatalogue(long commercialCatalogueId, [FromBody] UpdateCommercialCatalogueModelView updateCommercialCatalogueModelView) { if (updateCommercialCatalogueModelView == null) { return(BadRequest(new SimpleJSONMessageService(INVALID_REQUEST_BODY_MESSAGE))); } try { updateCommercialCatalogueModelView.commercialCatalogueId = commercialCatalogueId; GetCommercialCatalogueModelView getCommercialCatalogueModelView = new core.application.CommercialCatalogueController() .updateCommercialCatalogue(updateCommercialCatalogueModelView); return(Ok(getCommercialCatalogueModelView)); } 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 addCatalogueCollectionProduct(long commercialCatalogueId, long customizedProductCollectionId, [FromBody] AddCatalogueCollectionProductModelView addCatalogueCollectionProductModelView) { if (addCatalogueCollectionProductModelView == null) { return(BadRequest(new SimpleJSONMessageService(INVALID_REQUEST_BODY_MESSAGE))); } try { addCatalogueCollectionProductModelView.commercialCatalogueId = commercialCatalogueId; addCatalogueCollectionProductModelView.customizedProductCollectionId = customizedProductCollectionId; GetCommercialCatalogueModelView commercialCatalogueModelView = new core.application.CommercialCatalogueController() .addCatalogueCollectionProduct(addCatalogueCollectionProductModelView); return(Ok(commercialCatalogueModelView)); } 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 findAll() { try { GetAllCommercialCataloguesModelView allCommercialCataloguesModelView = new core.application.CommercialCatalogueController().findAll(); return(Ok(allCommercialCataloguesModelView)); } catch (ResourceNotFoundException e) { return(NotFound(new SimpleJSONMessageService(e.Message))); } catch (Exception) { return(StatusCode(500, new SimpleJSONMessageService(UNEXPECTED_ERROR))); } }
public ActionResult findById(long id) { try { FindCommercialCatalogueModelView findCommercialCatalogueModelView = new FindCommercialCatalogueModelView(); findCommercialCatalogueModelView.commercialCatalogueId = id; GetCommercialCatalogueModelView getCommercialCatalogueModelView = new core.application.CommercialCatalogueController().findCommercialCatalogue(findCommercialCatalogueModelView); return(Ok(getCommercialCatalogueModelView)); } catch (ResourceNotFoundException e) { return(NotFound(new SimpleJSONMessageService(e.Message))); } catch (Exception) { return(StatusCode(500, new SimpleJSONMessageService(UNEXPECTED_ERROR))); } }
public ActionResult findCatalogueCollectionProducts(long commercialCatalogueId, long customizedProductCollectionId) { try { FindCatalogueCollectionModelView findCatalogueCollectionModelView = new FindCatalogueCollectionModelView(); findCatalogueCollectionModelView.commercialCatalogueId = commercialCatalogueId; findCatalogueCollectionModelView.customizedProductCollectionId = customizedProductCollectionId; GetAllCustomizedProductsModelView getCustomizedProductsModelView = new core.application.CommercialCatalogueController().findCatalogueCollectionProducts(findCatalogueCollectionModelView); return(Ok(getCustomizedProductsModelView)); } catch (ResourceNotFoundException e) { return(NotFound(new SimpleJSONMessageService(e.Message))); } catch (Exception) { return(StatusCode(500, new SimpleJSONMessageService(UNEXPECTED_ERROR))); } }
public ActionResult addCommercialCatalogue([FromBody] AddCommercialCatalogueModelView addCommercialCatalogueModelView) { if (addCommercialCatalogueModelView == null) { return(BadRequest(new SimpleJSONMessageService(INVALID_REQUEST_BODY_MESSAGE))); } try { GetCommercialCatalogueModelView getCommercialCatalogueModelView = new core.application.CommercialCatalogueController() .addCommercialCatalogue(addCommercialCatalogueModelView); return(CreatedAtRoute("GetCommercialCatalogue", new { id = getCommercialCatalogueModelView.commercialCatalogueId }, getCommercialCatalogueModelView)); } catch (ArgumentException e) { return(BadRequest(new SimpleJSONMessageService(e.Message))); } catch (Exception) { return(StatusCode(500, new SimpleJSONMessageService(UNEXPECTED_ERROR))); } }