public IHttpActionResult SetDimensionCategoryAction([FromUri] GetDimensionCategoriesByIdProductRequest uriObj, [FromBody] SetDimensionCategoryRequest requestObj) { try { // Verify at least object arrives with data if (requestObj == null) { throw new NotEnoughAttributesException("No se ha recibido ningún parámetro"); } // Verify required parameters if (String.IsNullOrEmpty(requestObj.description) || uriObj.idProduct == 0 || String.IsNullOrEmpty(requestObj.tagName)) { throw new NotEnoughAttributesException("No se han recibido todos los parámetros requeridos"); } // Business layer ActionResponse action = core.SetDimensionCategoryAction( uriObj.idProduct, requestObj ); if (action.code == (int)CodeStatusEnum.OK) { return(ResponseOk(action.data)); } else { return(ResponseError(action.code, action.message)); } } catch (NotValidDataException e) { logger.Error(e.Message); return(ResponseError((int)CodeStatusEnum.BAD_REQUEST, e.Message)); } catch (NotEnoughAttributesException e) { logger.Error(e.Message); return(ResponseError((int)CodeStatusEnum.BAD_REQUEST, e.Message)); } catch (Exception ex) { logger.Fatal(ex.Message); return(ResponseError((int)CodeStatusEnum.INTERNAL_ERROR, "Error desconocido en el sistema: " + ex.Message)); } }
public IHttpActionResult GetDimensionCategories([FromUri] GetDimensionCategoriesByIdProductRequest requestObj) { try { // Verify required parameters if (requestObj.idProduct == 0) { throw new NotEnoughAttributesException("No se han recibido todos los parámetros requeridos"); } // Actions into business layer ActionResponse action = core.GetDimensionCategoriesAction(requestObj.idProduct); if (action.code == (int)CodeStatusEnum.OK) // OK { return(ResponseOk(action.data)); } else { return(ResponseError(action.code, action.message)); } } catch (NotValidDataException e) { logger.Error(e.Message); return(ResponseError((int)CodeStatusEnum.BAD_REQUEST, e.Message)); } catch (NotEnoughAttributesException e) { logger.Error(e.Message); return(ResponseError((int)CodeStatusEnum.BAD_REQUEST, e.Message)); } catch (Exception ex) { logger.Fatal(ex.Message); return(ResponseError((int)CodeStatusEnum.INTERNAL_ERROR, "Error desconocido en el sistema: " + ex.Message)); } }