public void Patch(string id, [FromBody] MergePatchWarehouseDto value) { try { WarehousesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _warehouseApplicationService.When(value as IMergePatchWarehouse); } catch (Exception ex) { var response = WarehousesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Delete(string id, string commandId, string version, string requesterId = default(string)) { try { var value = new DeleteWarehouseDto(); value.CommandId = commandId; value.RequesterId = requesterId; value.Version = (long)Convert.ChangeType(version, typeof(long)); WarehousesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _warehouseApplicationService.When(value as IDeleteWarehouse); } catch (Exception ex) { var response = WarehousesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteWarehouseDto value) { try { // /////////////////////////////// if (value.Version != default(long)) { value.CommandType = CommandType.MergePatch; WarehousesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _warehouseApplicationService.When(value as IMergePatchWarehouse); return; } // /////////////////////////////// WarehousesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _warehouseApplicationService.When(value as ICreateWarehouse); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }